Image preview method and device, electronic equipment and computer storage medium
By determining the mapping relationship and the number of interpolated frames during the sliding zoom operation, and using Bezier curves to generate a smooth preview image, the problem of abrupt FOV changes and stuttering during the sliding zoom process is solved, and the smoothness of the preview image is improved.
Patent Information
- Application Number
- CN202511442509.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2026-01-23
AI Technical Summary
In existing technologies, the preview screen during the zoom process suffers from abrupt changes in FOV or stuttering, affecting the smoothness of the preview screen.
By determining the mapping relationship and the number of frames interpolated corresponding to the operation information of the sliding zoom operation, frames are interpolated between the first zoom level and the second zoom level based on the mapping relationship, and a smooth preview image is generated by combining the Bezier curve.
The smoothness of the preview screen has been improved, avoiding stuttering or lag caused by rapid changes in zoom magnification, and achieving smoother zoom magnification changes.
Smart Images

Figure CN121397352A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to image preview technology, and in particular to an image preview method and device, an electronic device, and a computer storage medium. BACKGROUND
[0002] At present, a user can change a zoom ratio on a mobile phone in a sliding zoom manner, and a preview picture in a sliding zoom process needs to have smoothness.
[0003] However, in the related art, for a preview picture in a sliding zoom process, a zoom ratio is determined based on a two-segment curve to generate the preview picture, and the preview picture generated in this manner has a relatively abrupt change in a field of view (FOV) or a FOV change lag or a FOV change rollback due to a secondary camera being pulled up in a timely manner, resulting in a preview picture lag or a preview picture rollback and affecting the smoothness of the preview picture. SUMMARY
[0004] Embodiments of the present application provide an image preview method, device, electronic device, and computer storage medium, which can improve the smoothness of a preview picture.
[0005] The technical solution of the present application is implemented as follows: In a first aspect, an embodiment of the present application provides an image preview method, comprising: receiving and responding to a sliding zoom operation, determining a mapping relationship corresponding to operation information of the sliding zoom operation and an interpolation frame number; wherein the mapping relationship is a mapping relationship between image frames and zoom ratios; determining, based on the mapping relationship, a zoom ratio corresponding to an inserted frame when interpolation is performed on an interpolation frame position between a first zoom ratio and a second zoom ratio with the interpolation frame number; determining a current zoom ratio according to the zoom ratio corresponding to the inserted frame; cropping an image frame corresponding to the current zoom ratio according to the current zoom ratio, and generating a current preview picture of the current zoom ratio based on the cropped image frame.
[0006] In a second aspect, an embodiment of the present application provides an image preview device, comprising: a response module configured to receive and respond to a sliding zoom operation, and determine a mapping relationship corresponding to operation information of the sliding zoom operation and an interpolation frame number; wherein the mapping relationship is a mapping relationship between image frames and zoom ratios; a first determination module configured to determine, based on the mapping relationship, a zoom ratio corresponding to an inserted frame when interpolation is performed on an interpolation frame position between a first zoom ratio and a second zoom ratio with the interpolation frame number; a second determining module, configured to determine a current zoom ratio according to a zoom ratio corresponding to the inserted frame; a cropping module, configured to crop an image frame corresponding to the current zoom ratio according to the current zoom ratio, and generate a current preview picture of the current zoom ratio based on the cropped image frame.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a storage medium storing instructions executable by the processor; the storage medium performs operations in dependence on the processor, and when the instructions are executed by the processor, the processor performs the image preview method in any one or more of the above embodiments.
[0008] In a fourth aspect, an embodiment of the present application provides a computer storage medium storing executable instructions, and when the executable instructions are executed by one or more processors, the processors perform the image preview method in any one or more of the above embodiments.
[0009] The embodiments of the present application provide an image preview method and device, an electronic device and a computer storage medium, including: receiving and responding to a sliding zoom operation, determining a mapping relationship corresponding to operation information of the sliding zoom operation and an interpolation frame number, the mapping relationship being a mapping relationship between image frames and zoom ratios, determining, based on the mapping relationship, a zoom ratio corresponding to an inserted frame when interpolation is performed on interpolation frame positions between a first zoom ratio and a second zoom ratio with the interpolation frame number, determining a current zoom ratio according to the zoom ratio corresponding to the inserted frame, cropping an image frame corresponding to the current zoom ratio according to the current zoom ratio, and generating a current preview picture of the current zoom ratio based on the cropped image frame; that is, in the embodiments of the present application, the mapping relationship corresponding to the operation information of the sliding zoom operation and the interpolation frame number are determined, so that the corresponding relationship between the operation information, the mapping relationship and the interpolation frame number is set, the appropriate mapping relationship and interpolation frame number can be determined for different operation information, the zoom ratio corresponding to the inserted frame when interpolation is performed on the interpolation frame positions between the first zoom ratio and the second zoom ratio with the interpolation frame number can be determined based on the mapping relationship, the current zoom ratio is determined, the cropped image frame is obtained through cropping, and then the current preview picture is generated, so that the zoom ratio of the current preview picture changes with the change of the operation information, the change of the current zoom ratio presents a change from fast to slow by setting the corresponding relationship between the operation information, the mapping relationship and the interpolation frame number, and the pull-up state of the target camera is considered, thus avoiding the lag or pullback of the preview picture caused by the too fast change of the zoom ratio and the target camera not being pulled up, and the smoothness of the preview picture is improved. BRIEF DESCRIPTION OF DRAWINGS
[0010] Figure 1aFig. 1 is a schematic diagram of a shooting picture of a main camera in the related art; Figure 1b Fig. 2 is a schematic diagram of a shooting picture of a main camera in the related art; Figure 2a Fig. 3 is a schematic diagram of a shooting picture of an ultra-wide-angle camera in the related art; Figure 2b Fig. 4 is a schematic diagram of a shooting picture of an ultra-wide-angle camera in the related art; Figure 2c Fig. 5 is a schematic diagram of an image obtained by shooting of an ultra-wide-angle camera in the related art; Figure 3a Fig. 6 is a schematic diagram of a fixed-focus lens in the related art; Figure 3b Fig. 7 is a schematic diagram of a lens relay zoom in the related art; Figure 4 Fig. 8 is a schematic diagram of a sliding zoom function in the related art; Figure 5 Fig. 9 is a schematic diagram of a mapping curve in the related art; Figure 6 Fig. 10 is a schematic diagram of a flow of an optional image preview method provided by an embodiment of the present application; Figure 7 Fig. 11 is a schematic diagram of a flow of an example one of an optional image preview method provided by an embodiment of the present application; Figure 8 Fig. 12 is a schematic diagram of a mapping curve in the related art; Figure 9 Fig. 13 is a schematic diagram of an optional mapping curve provided by an embodiment of the present application; Figure 10 Fig. 14 is a schematic diagram of a flow of an example two of an optional image preview method provided by an embodiment of the present application; Figure 11 Fig. 15 is a schematic diagram of an optional mapping curve provided by an embodiment of the present application; Figure 12 Fig. 16 is a schematic diagram of a structure of an optional image preview device provided by an embodiment of the present application; Figure 13 Fig. 17 is a schematic diagram of a structure of an optional electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0011] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application.
[0012] In the related art, the camera lens support scheme of the current mobile phone generally supports 3-5 different types of lenses. Generally, the camera operation page of a multi-camera mobile phone will have a zoom ratio switching selection of 0.6X, 1X, 2X or 5X, 10X zoom ratio. The smaller the number, the wider the shot, and the larger the number, the farther the shot, which also roughly corresponds to the zoom ratio of the ultra-wide-angle camera, the main camera and the long-focus camera.
[0013] For the main camera, the main camera of most mobile phones is generally a wide-angle lens equivalent to about 28mm. Because this zoom range is close to the "viewing range of the human eye", what you see is what you shoot, and it is also the camera with the highest usage frequency. Figure 1a For a schematic diagram of the shooting picture of the main camera in the related art, as shown in Figure 1a , opening the operation page of the mobile phone camera, the value of 1X can be seen on the page of mobile phone A, and the shooting picture when the zoom ratio is 1X, Figure 1b For a schematic diagram of the shooting picture of the main camera in the related art, as shown in Figure 1b , opening the operation page of the mobile phone camera, the value of 1X can be seen on the page of mobile phone B, and the shooting picture when the zoom ratio is 1X. The picture quality at 1X is the best among all focal lengths, suitable for shooting portraits, buildings, landscapes and documentaries, etc.
[0014] For the ultra-wide-angle camera, the ultra-wide-angle camera can provide a wider field of view than the main camera. It should be noted that the zoom ratio of the ultra-wide-angle camera is displayed differently on some mobile phone cameras, such as, Figure 2a For a schematic diagram of the shooting picture of the ultra-wide-angle camera in the related art, as shown in Figure 2a , mobile phone B displays 0.5X. Figure 2b For a schematic diagram of the shooting picture of the ultra-wide-angle camera in the related art, as shown in Figure 2b , mobile phone C displays 0.6X. Mobile phone D directly displays the word wide-angle.
[0015] Figure 2c For a schematic diagram of the image obtained by the ultra-wide-angle camera in the related art, as shown in Figure 2c , compared with the main camera, the ultra-wide-angle camera can shoot a wider picture, suitable for shooting landscapes and buildings, and can obtain a powerful picture feeling.
[0016] In addition, the ultra-wide-angle camera has a very large viewing range, and you can obtain a wider picture at the same location, which greatly facilitates the subsequent re-cropping. When shooting landscapes, using an ultra-wide-angle camera can let more landscape elements into the shot, and as long as the composition is used, it can reflect the depth and space of the picture, making the entire landscape photo look majestic.
[0017] Ultra-wide-angle camera has a lens distortion feature by nature, which will make the things at the edge of the photo be stretched and enlarged. It can be used to take an overhead shot, which can create a visual impact of "near big and far small". When shooting a building, the camera's distortion feature can make the building look more magnificent.
[0018] For a long-focus camera, a zoom ratio of 1X or more is usually called long-focus, and the higher the coefficient in front of X, the farther the camera can shoot. For example, the 5X optical zoom ratio on the D phone allows the camera to switch from the main camera to the long-focus camera when the zoom ratio is switched to 5X. The long-focus camera can shoot higher-quality photos from a distance, shoot objects farther away, or enlarge objects in the frame without causing a drop in image quality like digital zoom. In situations where it is not convenient to move around, it is difficult to capture the subject with the main camera of the phone, and the use of the long-focus camera can make the ordinary photo more layered.
[0019] The long-focus camera can "shorten" the distance between the background and the foreground, creating a sense of compression of spatial distance, making the overall picture more substantial. This "compression" is one of the characteristics of long-focus cameras. Long-focus cameras have less distortion and weak perspective, which can shorten the distance between the foreground and the background, enhance the relationship between the foreground and the background, and create some unique visual effects. Using this feature, you can use straight and extended objects such as roads and railings as guide lines to direct the viewer's attention to the subject in the depth of the picture.
[0020] In summary, although multi-camera phones cannot guarantee that you can take better photos, each camera has different characteristics. Therefore, there is a Spatial Alignment Transform (SAT) scheme in the current camera shooting scheme to switch the camera lens in real time according to user needs in different shooting scenarios.
[0021] For example, a phone uses the following fixed-focus lenses: 40MP, super-sensitivity, equivalent focal length 27mm, F1.6, equivalent to the above main camera; 20MP, ultra-wide-angle, equivalent focal length 16mm, F2.2, equivalent to the above ultra-wide-angle camera; 8MP, periscopic long-focus, equivalent focal length 125mm, F3.4, equivalent to the above long-focus camera.
[0022] The focal length changes continuously between 16-27mm and 27-125mm, and through digital zoom fusion, a continuous zoom of 16-125mm is finally achieved.
[0023] Figure 3aA schematic diagram of selecting a fixed-focus lens in the related art, as shown in Figure 3a includes state display lights of a main camera (main) 31, a super wide-angle camera (wide) 32, and a long-focus camera (telephone) 33, and also includes state display lights of a flash (flash) 34 and a time of flight (TOF) 35.
[0024] Figure 3b A schematic diagram of lens relay zooming in the related art, as shown in Figure 3b When the zoom ratio of a preview picture 36 is 1X, the main camera is turned on and the other cameras are turned off; when the zoom ratio of a preview picture 37 is 2X, the main camera is turned on and the other cameras are turned off; when the zoom ratio of a preview picture 38 is 3X, the main camera and the long-focus camera are turned on and the other cameras are turned off; and when the zoom ratio of a preview picture 39 is 5X, the long-focus camera is turned on and the other cameras are turned off.
[0025] In the process of zooming, how to ensure the smoothness of switching of the lens (continuous flow) and reduce the jump of the image (perform spatial alignment processing to ensure that the image effects before and after switching are consistent) becomes a problem that needs to be considered by the camera.
[0026] Figure 4 A schematic diagram of a sliding zoom function in the related art, as shown in Figure 4 A sliding zoom dial 41 is displayed on an opening interface of a camera application. For a sliding scene, the sliding scene has the characteristics of random direction, random speed, high requirements for hand following (start hand following and end hand following), and needs to take into account the impact of power consumption (try to avoid turning on all three cameras) and platform resource limitations (3 TFE (3 TFE represents the maximum total parallel computing resources that can be called by the platform)) at the same time during design and development. Therefore, it is necessary to try to balance all aspects and focus on different sliding scene characteristics (for example, zoom in (zoom ratio increases) scene focuses on the hand following of stopping and the smoothness of FOV change, and zoom out (zoom ratio decreases) fast sliding and passing through the light change point scene focuses on the number of frames to give the target lens time to turn on). Therefore, more detailed scene division is needed, and then differential frame insertion control is needed for the detailed scenes.
[0027] Figure 5 A schematic diagram of a mapping curve one in the related art, as shown in Figure 5 The mapping curve is divided into a curve 51 and a curve 52, and the zoom ratio in the left table is the numerical change of the zoom ratio in the curve 51 and the curve 52; wherein the curve 51 is relatively smooth, and the curve 52 changes slowly at first and then quickly decreases.
[0028] It can be seen that the number of interpolated frames and the mapping curve (trend of FOV change) are not explicitly processed in the current sliding zoom scheme and experience, and therefore, the FOV change is often abrupt or the FOV change is stalled or retracted due to the late lifting of the secondary camera during sliding. In addition, for zoom out scenes, due to hardware resource limitations, even if the three cameras are kept on for a long time, there is still a need to switch sensors in fast sliding scenarios (turn off one sensor, and then turn on the new sensor using the released resources); and the sensor needs to be turned off and on for about 7 frames, so the switching time needs to be sufficient to avoid the FOV changing to the corresponding interval while the related sensor has not been turned on, which will also cause problems.
[0029] The sliding cut interpolation frame strategy used in the last generation takes into account the tail-out experience (tail interpolation) of the sliding cut tail and the differentiated interpolation frame strategy, but there is still obvious mutual coupling in debugging; and the zoom ratio changes little or reverses when the two curves are connected (FOV is ton or retracted), so the focus of this generation is to redesign the mapping curve and interpolation control strategy for the convenience of debugging and the smoothness of switching.
[0030] To solve the technical problem that the preview image is not smooth due to preview image stall or retraction in related art sliding zoom, an image preview method is provided in the embodiments of the present application, Figure 6 An optional image preview method provided in the embodiments of the present application is shown in the flowchart of Figure 6 As shown in the figure, the image preview method can include: S601: receiving and responding to a sliding zoom operation, determining the mapping relationship and the number of interpolated frames corresponding to the operation information of the sliding zoom operation; The image preview method provided in the embodiments of the present application can be executed by an electronic device, which can be a smartphone, a tablet computer, etc. Herein, the embodiments of the present application do not make specific limitation thereto.
[0031] For example, after receiving the sliding zoom operation of the dial sliding zoom, the operation information of the sliding zoom operation is determined in response to the operation. The operation information can include the operation time of the sliding zoom operation, and can also include the initial value of the zoom ratio of the sliding zoom operation, and can also include the zoom ratio to which the sliding zoom operation slides, and can also include a flag indicating whether the sliding zoom operation is a sliding end event, etc. Herein, the embodiments of the present application do not make specific limitation thereto.
[0032] After the operation information of the sliding zoom operation is determined, the corresponding mapping relationship and the number of inserted frames can be determined according to the operation information, wherein the electronic device has pre-stored a corresponding relationship among the operation information, the mapping relationship and the number of inserted frames, so that after the operation information is determined, the corresponding mapping relationship and the number of inserted frames can be determined from the corresponding relationship by searching.
[0033] The mapping relationship is the mapping relationship between the image frame and the zoom ratio, that is, the operation information is determined to determine the mapping relationship between the image frame and the zoom ratio under the operation information, and the number of inserted frames is determined.
[0034] The mapping relationship can be a mapping curve, and the horizontal axis of the two-dimensional coordinate axis of the curve represents the image frame, and the vertical axis represents the zoom ratio.
[0035] It should be noted that the above image preview method is applied to the sliding zoom operation, that is, when the zoom operation is the sliding zoom operation, the above image preview method is executed.
[0036] S602: determining, based on the mapping relationship, the zoom ratio corresponding to the inserted frame when the number of inserted frames is inserted at the inserted frame position between the first zoom ratio and the second zoom ratio; After the corresponding mapping relationship and the number of inserted frames are obtained through the above S601, in S602, the electronic device determines the inserted frame position between the first zoom ratio and the second zoom ratio based on the mapping relationship, wherein for the mapping curve, the two points on the horizontal axis corresponding to the first zoom ratio and the second zoom ratio can be called the inserted frame position, and the inserted frame position is mainly the inserted frame position in time.
[0037] Here, based on the mapping relationship, the zoom ratio corresponding to the inserted frame when the number of inserted frames is inserted at the inserted frame position between the first zoom ratio and the second zoom ratio is determined. The first zoom ratio is the initial value of the zoom ratio of the sliding zoom operation; the second zoom ratio is the zoom ratio to which the sliding zoom operation slides.
[0038] That is, the mapping relationship is the mapping relationship between the image frame and the zoom ratio, so after the corresponding mapping relationship and the number of inserted frames are determined, the initial value of the zoom ratio of the sliding zoom operation and the zoom ratio to which the sliding zoom operation slides are found on the mapping relationship, and the number of inserted frames is inserted at the inserted frame position between the two values.
[0039] For example, taking the mapping relationship as a mapping curve, a point of the initial zoom ratio of the zooming operation and a point of the zoom ratio to which the zooming operation slides are found on the curve, and then the two points on the horizontal axis of the two-dimensional coordinate system are taken as the interpolation positions of the mapping curve, interpolation is performed, so that the inserted frame can be obtained, and the corresponding zoom ratio of the inserted frame can be obtained through the mapping curve.
[0040] The interpolation position between the initial zoom ratio of the zooming operation and the zoom ratio to which the zooming operation slides is found on the mapping relationship, and random interpolation is performed on the interpolation position with the number of interpolations.
[0041] S603: determining the current zoom ratio according to the corresponding zoom ratio of the inserted frame; After obtaining the corresponding zoom ratio of the inserted frame through S602, the electronic device can determine the current zoom ratio according to the corresponding zoom ratio of the inserted frame in S603, where the current zoom ratio is the zoom ratio of the current preview picture.
[0042] The corresponding zoom ratio of the Nth frame in the inserted frame can be taken as the current zoom ratio, where N is greater than or equal to 1 and less than or equal to the number of interpolations, or the corresponding zoom ratios of the inserted frames can be counted, and the current zoom ratio can be determined based on the counting result. Here, the embodiments of the present application do not make specific limitations.
[0043] S604: cropping the image frame corresponding to the current zoom ratio according to the current zoom ratio, and generating the current preview picture of the current zoom ratio based on the cropped image frame.
[0044] After obtaining the current zoom ratio through S603, the image frame corresponding to the current zoom ratio can be obtained, where the image frame corresponding to the current zoom ratio is the image frame captured by the camera corresponding to the zoom ratio interval in which the current zoom ratio is located.
[0045] That is, after the current zoom ratio is determined, the zoom ratio interval in which the current zoom ratio is located can be determined, and then the image frame captured by the camera corresponding to the zoom ratio interval in which the current zoom ratio is located can be obtained.
[0046] For example, if the current zoom ratio is 7X, the zoom ratio intervals can include 0.6X-1X, 1X-3X and 3X-100X, and the zoom ratio interval in which the current zoom ratio is located is 3X-100X, wherein the camera corresponding to the zoom ratio interval is a long-focus camera, and the long-focus camera collects an image frame at a zoom ratio of 3X, so that the image frame at 3X can be cropped to obtain the current preview picture at 7X.
[0047] In addition, it should be noted that three cameras are taken as an example, and the zoom ratio intervals can include 0.6X-1X, 1X-3X and 3X-100X, and the main camera collects an image frame at a zoom ratio of 1X, the ultra-wide-angle camera collects an image frame at a zoom ratio of 0.6X, and the long-focus camera collects an image frame at a zoom ratio of 3X.
[0048] Further, in order to determine the corresponding mapping relationship and the number of interpolated frames according to the operation information, in an optional embodiment, determining the mapping relationship and the number of interpolated frames corresponding to the operation information of the sliding zoom operation can include: determining attribute feature information of the sliding zoom operation according to the operation information; determining the corresponding mapping relationship and the number of interpolated frames according to the attribute feature information.
[0049] Here, after the operation information is determined, the attribute feature information of the sliding zoom operation can be determined according to the operation information, wherein the attribute feature information includes at least one of the following: sliding speed, sliding direction, zoom ratio interval in which the first zoom ratio is located, and whether the sliding zoom operation is a sliding stop event.
[0050] That is, the electronic device can determine one or more of the sliding speed, the sliding direction, the zoom ratio interval in which the first zoom ratio is located, and whether the sliding zoom operation is a sliding stop event through the determined operation information, and the present embodiment does not make a specific limitation here.
[0051] After one or more of the above attribute feature information is obtained, the corresponding mapping relationship and the number of interpolated frames can be determined according to the obtained attribute feature information, that is, one or more of the sliding speed, the sliding direction, the zoom ratio interval in which the first zoom ratio is located, and whether the sliding zoom operation is a sliding stop event is determined to determine the corresponding mapping relationship and the number of interpolated frames.
[0052] In this way, the electronic device can determine the corresponding mapping relationship and the number of inserted frames based on one or more of the sliding speed, the sliding direction, the zoom ratio interval in which the first zoom ratio is located, and whether the sliding zoom operation is a sliding stop event, so that the determined mapping relationship between the inserted frames and the zoom ratio and the number of inserted frames are related to one or more of the sliding speed, the sliding direction, the zoom ratio interval in which the first zoom ratio is located, and whether the sliding zoom operation is a sliding stop event, thereby determining a more appropriate mapping relationship and the number of inserted frames for the sliding zoom operation.
[0053] To obtain the sliding speed, in an optional embodiment, determining the attribute characteristic information of the sliding zoom operation according to the operation information can include: determining the first zoom ratio, the second zoom ratio, and the time length of the sliding zoom operation from the operation information; determining the sliding speed according to the first zoom ratio, the second zoom ratio, and the time length of the sliding zoom operation.
[0054] It can be understood that the electronic device can determine the first zoom ratio, the second zoom ratio, and the time length of the sliding zoom operation from the operation information, determine the difference between the second zoom ratio and the first zoom ratio, and determine the ratio of the difference to the time length, which can be taken as the sliding speed.
[0055] In this way, the sliding speed is determined in the above manner, so that the corresponding mapping relationship and the number of inserted frames can be determined based on the sliding speed or the sliding speed and other attribute characteristic information, so that the determined corresponding mapping relationship and the number of inserted frames are related to the sliding speed of the sliding zoom operation, which is beneficial to determining the mapping relationship and the number of inserted frames that meet the sliding speed in combination with the sliding speed, to determine the current zoom ratio that meets the sliding speed, and to determine the current preview image that meets the sliding speed, thereby improving the smoothness of the preview image.
[0056] To determine the sliding direction, in an optional embodiment, determining the attribute characteristic information of the sliding zoom operation according to the operation information can include: determining the sliding direction according to the first zoom ratio and the second zoom ratio.
[0057] In the embodiments of the present application, the sliding direction can include a sliding direction in which the zoom ratio decreases and a sliding direction in which the zoom ratio increases, and then the electronic device can determine the sliding direction based on the size relationship between the first zoom ratio and the second zoom ratio.
[0058] For example, when the first zoom ratio is greater than the second zoom ratio, the sliding direction is the sliding direction in which the zoom ratio decreases, and when the first zoom ratio is less than the second zoom ratio, the sliding direction is the sliding direction in which the zoom ratio increases.
[0059] Thus, the sliding direction is determined in the above manner, so that the corresponding mapping relationship and the number of interpolated frames can be determined based on the sliding direction or the sliding direction and other attribute feature information, so that the determined corresponding mapping relationship and the number of interpolated frames are related to the sliding direction of the sliding zoom operation, which is beneficial to determine the mapping relationship and the number of interpolated frames that meet the sliding speed in combination with the sliding direction, to determine the current zoom ratio that meets the sliding direction, and to determine the current preview image that meets the sliding direction, thereby improving the smoothness of the preview image.
[0060] To determine the zoom ratio interval in which the first zoom ratio is located, in an optional embodiment, determining attribute feature information of the sliding zoom operation according to operation information can include: Determining, from the zoom ratio interval corresponding to the camera of the electronic device, the zoom ratio interval in which the first zoom ratio is located.
[0061] Here, the electronic device stores the zoom ratio interval corresponding to each camera, and three cameras are taken as an example, and the zoom ratio interval can include 0.6X-1X, 1X-3X and 3X-100X. The ultra-wide-angle camera collects image frames at 0.6X to obtain a preview image, which can obtain a preview image of 0.6X-1X. The main camera collects image frames at 1X to obtain a preview image, which can obtain a preview image of 1X-3X. The long-focus camera collects image frames at 3X to obtain a preview image, which can obtain a preview image of 3X-100X.
[0062] Based on the above-mentioned zoom ratio interval corresponding to the three cameras, the zoom ratio interval in which the first zoom ratio is located can be known. For example, when the first zoom ratio is 12X, the zoom ratio interval in which the first zoom ratio is located is 3X-100X.
[0063] Thus, the zoom ratio interval in which the current frame is located is determined in the above manner, so that the corresponding mapping relationship and the number of interpolated frames can be determined based on the zoom ratio interval in which the current frame is located, or the zoom ratio interval in which the current frame is located and other attribute feature information, so that the determined corresponding mapping relationship and the number of interpolated frames are related to the zoom ratio interval in which the current frame of the sliding zoom operation is located, which is beneficial to determine the mapping relationship and the number of interpolated frames that meet the zoom ratio interval in which the current frame is located in combination with the zoom ratio interval in which the current frame is located, to determine the current zoom ratio that meets the zoom ratio interval in which the current frame is located, and to determine the current preview image that meets the zoom ratio interval in which the current frame is located, thereby realizing the change of the zoom ratio in the first block and then slow, and improving the smoothness of the preview image.
[0064] In order to determine whether the sliding zoom operation is a sliding stop event, in an optional embodiment, according to the operation information, determining the attribute feature information of the sliding zoom operation can include: In the case that the operation information carries the listening event, determining that the sliding zoom operation is a sliding stop event; In the case that the operation information does not carry the listening event, determining that the sliding zoom operation is not a sliding stop event.
[0065] The electronic device listens to the sliding zoom operation, and if the sliding zoom operation is a sliding end event, a listening event is obtained, and if the sliding zoom operation is not a sliding end event, the listening event cannot be obtained, wherein the listening event indicates the end of the sliding zoom.
[0066] Here, the flag bit of the end event can be used to determine whether the listening event is obtained, the operation information can be parsed to check the flag bit of the end event in the operation information, if it is 1, it is determined that the operation information carries the listening event, at this time, it is determined that the sliding zoom operation is a sliding stop event, if it is 0, it is determined that the operation information does not carry the listening event, at this time, it is determined that the sliding zoom operation is not a sliding stop event.
[0067] In this way, whether the sliding zoom operation is a sliding stop event is determined by the above-mentioned manner, so that the corresponding mapping relationship and the number of inserted frames can be determined based on whether the sliding zoom operation is a sliding stop event, or whether the sliding zoom operation is a sliding stop event and other attribute feature information, so that the determined corresponding mapping relationship and the number of inserted frames are related to whether the sliding zoom operation of the sliding zoom operation is a sliding stop event, which is beneficial to determine the mapping relationship and the number of inserted frames that meet whether the sliding zoom operation is a sliding stop event in combination with whether the sliding zoom operation is a sliding stop event, to determine the current zoom ratio that meets whether the sliding zoom operation is a sliding stop event, and to determine the current preview image that meets whether the sliding zoom operation is a sliding stop event, and to improve the smoothness of the preview image.
[0068] After obtaining the attribute feature information, in order to obtain the corresponding mapping relationship and the number of inserted frames, in an optional embodiment, according to the attribute feature information, determining the corresponding mapping relationship and the number of inserted frames can include: According to the attribute feature information, determining the corresponding coefficient and the number of inserted frames; According to the coefficient, determining the corresponding Bezier curve to obtain the corresponding mapping relationship.
[0069] In the related art, the mapping relationship can be constituted by two curves. In the embodiment of the present application, the corresponding coefficient and the number of interpolation frames can be determined according to the attribute characteristic information, the coefficient can be used to determine the corresponding Bezier curve, and the mapping relationship in the corresponding Bezier curve is the corresponding mapping relationship.
[0070] In this way, the corresponding coefficient is determined to determine the corresponding Bezier curve, and then the corresponding mapping relationship is determined, that is, the Bezier curve is used as the mapping relationship, that is, the corresponding mapping relationship is constituted by a curve, so that the mapping curve is smoother, and the determined current zoom ratio is smoother, which is beneficial to improve the smoothness of the preview picture.
[0071] In order to further improve the smoothness of the preview picture, in an optional embodiment, S601 can include: The camera application of the electronic device receives and responds to the sliding zoom operation, determines the operation information of the sliding zoom operation, and sends the operation information to the HAL of the electronic device. The HAL determines the corresponding mapping relationship and the number of interpolation frames according to the operation information of the sliding zoom operation.
[0072] Here, the camera application receives and responds to the sliding zoom operation, determines the operation information of the sliding zoom operation, and sends the operation information to the HAL, that is, the camera application does not execute the step of generating the current preview picture, but the HAL executes the step of determining the corresponding mapping relationship according to the operation information of the sliding zoom operation.
[0073] In this way, the camera application no longer needs to execute the processing of generating the current preview picture on the camera application side, but places all the processing of generating the current preview picture on the bottom layer, saves the load of the sliding zoom scene, and is beneficial to generate the preview picture more quickly to improve the smoothness of the preview picture.
[0074] In addition, in order to improve the smoothness of the preview picture, in an optional embodiment, the camera application of the electronic device receives and responds to the sliding zoom operation, determines the operation information of the sliding zoom operation, and sends the operation information to the HAL of the electronic device, which can include: The camera application receives and responds to the sliding zoom operation, determines the operation information of the sliding zoom operation every preset time interval, and sends the operation information to the HAL of the electronic device.
[0075] In the embodiments of the present application, the camera application receives and responds to the sliding zoom operation, determines operation information of the sliding zoom operation every preset time interval, and sends the operation information to the HAL, that is, the camera application sends the determined operation information to the HAL at intervals, so that the HAL can generate a current preview picture based on the operation information received at intervals, thereby generating a preview picture every preset time interval.
[0076] In this way, the camera application sends the operation information to the HAL at intervals, so that the HAL can interpolate frames at intervals, thereby ensuring timely interpolation of frames and improving the smoothness of the preview picture.
[0077] For the applicability of the image preview method provided in the embodiments of the present application, in an optional embodiment, S601 can include: receiving and responding to a zoom operation, determining a type of the zoom operation; in a case where the type of the zoom operation is a sliding zoom operation, determining a corresponding mapping relationship and an interpolation frame number according to operation information of the sliding zoom operation.
[0078] Since the embodiments of the present application are directed to a sliding zoom scenario, after receiving the zoom operation, the electronic device needs to identify the type of the zoom operation. Since the type of the zoom operation can include a sliding zoom operation and can also include a point-cut zoom scenario, by identifying the type of the zoom operation after receiving the zoom operation, the type of the zoom operation is obtained.
[0079] in a case where the type of the zoom operation is a sliding zoom operation, determining a corresponding mapping relationship and an interpolation frame number according to operation information of the sliding zoom operation. In a case where the type of the zoom operation is not a zoom operation, the image preview method provided in the embodiments of the present application is not executed.
[0080] In this way, the type of the zoom operation is determined by the above-mentioned zoom operation type identification method to determine whether to execute the image preview method provided in the embodiments of the present application, so that the image preview method provided in the embodiments of the present application is executed only in the sliding zoom scenario, thereby preventing the determination of an inappropriate preview picture in other scenarios.
[0081] In order to obtain the preview picture more quickly, in an optional embodiment, S602 can include: the HAL determines a zoom ratio corresponding to a frame inserted when interpolating the frame at the interpolation frame number at the interpolation position between the first zoom ratio and the second zoom ratio based on the mapping relationship; S603 can include: the HAL determines a current zoom ratio according to the zoom ratio corresponding to the inserted frame. S604 can include: the HAL cropping the image frame corresponding to the current zoom ratio according to the current zoom ratio, and generating a current preview picture of the current zoom ratio based on the cropped image frame.
[0082] It can be understood that, after obtaining the corresponding mapping relationship and the number of inserted frames, the HAL determines the zoom ratio corresponding to the inserted frame when the inserted frame is inserted at the insertion position between the first zoom ratio and the second zoom ratio by the number of inserted frames based on the mapping relationship, determines the current zoom ratio according to the zoom ratio corresponding to the inserted frame, crops the image frame corresponding to the current zoom ratio according to the current zoom ratio, and generates a current preview picture of the current zoom ratio based on the cropped image frame.
[0083] In this way, the HAL is used to generate the current preview picture, so that the camera application side does not need to perform the interpolation processing, and all is put to the bottom layer, which saves the load of the slide cutting scene, and improves the flexibility of the slide cutting effect debugging, and there is more time to pull up the target camera when issuing in time.
[0084] In order to determine the zoom ratio corresponding to the inserted frame, in an optional embodiment, S602 can include: based on the mapping relationship, determining the zoom ratio corresponding to the inserted frame when the inserted frame is inserted at equal intervals at the insertion position between the first zoom ratio and the second zoom ratio by the number of inserted frames.
[0085] In the embodiments of the present application, after obtaining the corresponding mapping relationship and the number of inserted frames, the insertion position between the first zoom ratio and the second zoom ratio is determined based on the mapping relationship. For example, in the case of taking the mapping curve as the mapping relationship, after the first zoom ratio and the second zoom ratio are found on the curve, the points on the horizontal axis of the two-dimensional coordinates where the first zoom ratio and the second zoom ratio are located on the mapping curve are determined, and the insertion position between the two points on the horizontal axis is determined.
[0086] Here, the inserted frame is obtained by inserting the inserted frame at equal intervals at the determined insertion position by the number of inserted frames, and the zoom ratio corresponding to the inserted frame is obtained based on the mapping curve.
[0087] In this way, the inserted frame is determined by the above-mentioned equal interval interpolation method, and the zoom ratio corresponding to the inserted frame is determined, so that the inserted frame is uniformly distributed on the insertion position, which is beneficial to determine the appropriate inserted frame for the attribute feature information, and further beneficial to determine the appropriate current zoom ratio.
[0088] In order to determine a more appropriate current zoom ratio, in an optional embodiment, S603 can include: The zoom ratio corresponding to the first frame of the inserted frame is determined as the current zoom ratio.
[0089] Here, the zoom ratio corresponding to the first frame of the inserted frame is used as the current zoom ratio. In other words, the zoom ratio corresponding to the first frame of the inserted frame is used as the current zoom ratio, so that the current zoom ratio is closer to the first zoom ratio. This prevents the abruptness caused by the large deviation between the zoom ratio of the current preview image and the previous preview image, and helps to improve the smoothness of the preview image.
[0090] In the case where the zoom operation is a zoom-stop event, in an optional embodiment, the above method may further include: If the operation information of the zoom operation determines that the zoom operation is a zoom stop event, the secondary camera of the electronic device at the second zoom level is turned off.
[0091] Understandably, in a sliding zoom scenario, there may be situations where the camera is pulled up, meaning there is a camera switching situation. Therefore, if the operation information of the sliding zoom operation determines that the sliding zoom operation is a sliding stop event, in order to prevent power consumption caused by unnecessary camera activation, the secondary camera of the electronic device at the second zoom level can be turned off.
[0092] For example, the first zoom level is 5X and the second zoom level is 2X. At 5X, the main camera is a telephoto camera, while at 2X, the main camera is the primary camera. Therefore, when the zoom operation stops at the second zoom level, the secondary cameras other than the main camera can be turned off.
[0093] In this way, by turning off the secondary camera of the electronic device at the second zoom level in the above manner, the power consumption of the electronic device can be reduced without affecting the generation of the preview image.
[0094] The following examples illustrate the image preview method described in one or more of the above embodiments.
[0095] This example proposes a dynamic control optimization scheme for the interpolation curve (equivalent to the mapping relationship mentioned above) and the number of interpolated frames in a sliding scene. The main idea is as follows: First, the mapping curve (equivalent to the mapping relationship mentioned above) in this example no longer distinguishes between different curve types (e.g., the exponential and Bezier segments of the previous generation). Furthermore, the camera application no longer performs frame interpolation processing; all frame interpolation processing is handled at the Hardware Abstraction Layer (HAL). The scheme primarily uses the sliding speed, sliding direction, zoom range of the current frame, and tail interpolation event information (equivalent to the sliding end event mentioned above) to dynamically update the curve coefficients of the interpolation curve (Bezier curve) to control the shape and trend of the curve, while simultaneously controlling the number of interpolated frames.
[0096] Among them, in the adjustment of the interpolation curve, the experience of fast first and slow later of FOV change is followed; after receiving the tail insertion event information, the tail curve is adjusted separately to obtain better slow-out effect (more slow-out frames, flatter curve), and the overall sliding zoom experience is comprehensively ensured.
[0097] Figure 7 An example of an optional image preview method provided by the embodiment of the present application is shown in the flowchart of Figure 7 The image preview method can include: S701: open the camera and start image preview / recording; S702: the user pulls up the zoom ratio switching dial and starts sliding zoom; S703: the camera application side performs zoom mode recognition, and if it is identified as a point-cut scene, S704 is executed; if it is identified as a sliding scene, S705 is executed; S704: execute point-cut scene control.
[0098] S705: sliding scene information recognition, obtain scene information; The scene information includes: the zoom ratio of the current frame, the zoom ratio interval where the current frame is located, the target zoom ratio, and the sliding end event information issued by the camera application.
[0099] S706: update the interpolation curve and the number of interpolations based on the scene information (+ stop zoom event); The camera application side converts the target zoom ratio based on the user's sliding behavior, without interpolation processing, and directly issues the target zoom ratio to the HAL; The HAL determines the sliding speed and sliding direction based on the zoom ratio of the current frame and the target zoom ratio; The HAL updates the coefficients of the lookup curve and the number of interpolations based on the sliding speed, the sliding direction, the zoom ratio interval where the current frame is located, and whether the sliding zoom is a zoom end event; Here, when it is detected that the sliding zoom is a zoom end event (the camera application issues to the HAL based on aidl, and the issuing speed is very fast), the HAL updates the tail interpolation curve (including: the coefficients and the number of interpolations corresponding to the tail curve) and performs tail interpolation processing.
[0100] S707: HAL calculates the zoom ratio of the next frame based on the Bezier curve and the number of interpolations; S708: HAL performs FOV cropping on the image frames captured by the camera corresponding to the zoom ratio range of the next frame based on the zoom ratio of the next frame. S709: HAL shuts down the secondary camera after reaching the user's desired zoom level; S710: HAL disables the frame interpolation processing algorithm and spatial alignment algorithm to complete the entire SAT switching process.
[0101] S711: HAL continues previewing or shooting / processing.
[0102] In other words, when a user triggers a zoom scene, it first determines whether it is a point-cut scene or a sliding scene (this can be distinguished by the zoom event sent by the camera application). If it is a sliding zoom scene, it follows the frame interpolation strategy (zoom ratio mapping) described in this example; if it is a point-cut scene, it follows the point-cut strategy (an alternative approach). When a sliding zoom scene is detected, the frame interpolation curve and frame number control logic designed in this example are used to dynamically adjust the curve and frame number based on the sliding speed, sliding direction, the zoom ratio range of the current frame, and the tail interpolation event information. After confirmation, the zoom ratio of the next frame is calculated according to the determined frame interpolation strategy (number of frames & curve), and the FOV cropping is handled according to the calculated zoom ratio value. Finally, when it is detected that the user has finished zooming (stops sliding) (an event is sent by the camera application), the tail end is softened out according to the tail curve and frame interpolation configuration.
[0103] In this example, if frame interpolation is not performed or the interpolation curve and strategy are unreasonable, it is easy for FOV to become jerky or erratic during sliding at different speeds, or the FOV change trend may not conform to the design of fast-then-slow. For example, Figure 8 This is a schematic diagram of the mapping curve in the related technology, as shown in Figure 2. Figure 8 As shown, curves 81 and 82 are included. Curve 81 is the curve abnormality caused by not interpolating frames, and curve 82 is the curve abnormality caused by interpolating two segments using different interpolation curves (which is reflected in the abnormal change of FOV).
[0104] In determining the interpolation curve, the slope change of the curve should fully consider the influence of the number of interpolations. For example, when interpolating 3 frames or 4 frames, in addition to the tail interpolation stage, in the middle stage of zooming, the zoom ratio of the first frame or the second frame calculated is basically used to respond to the FOV change of the next frame; if the fade-in is too much at the beginning of the interpolation curve, or the number of interpolations is too large, it will cause the zoom ratio of the next frame or the next next frame calculated to be too small compared with the zoom ratio of the current frame, resulting in a small FOV change amplitude in the first few frames or in the sliding continuous process, and a slow-fast situation, affecting the followability experience in the zooming process.
[0105] Figure 9 An optional mapping curve diagram provided by the embodiment of the application is shown in Figure 9, which includes curve 91, curve 92, curve 93, curve 94 and curve 95. The corresponding mapping curve obtained by the image preview method of the present example can include curve 91, curve 92, curve 93 and curve 94, so that the interpolation curve corresponding to the preview picture obtained is curve 95, and the interpolation curve of curve 95 has too much fade-in.
[0106] Therefore, the selection of the interpolation curve of the sliding cut is based on the zoom curve of the Bezier curve, and the number of interpolations is controlled by dynamically adjusting the curve coefficient based on the sliding speed, the zoom ratio interval of the current frame and whether the sliding end event is received. In the process of drawing a circle and sliding, it is ensured that the zoom ratio of the next frame and the zoom ratio of the next next frame calculated are compared with the current frame in the stage of rapid FOV change, and the curve trend is adjusted according to the fade-out effect after receiving the tail interpolation event information, and the number of interpolations is appropriately increased (for example, the number of interpolations is calculated according to 4 frames in the sliding process, and the number of interpolations is calculated according to 7 frames or 8 frames after receiving the tail interpolation event information to obtain the fade-out effect).
[0107] Figure 10 An optional flowchart of the second example of the image preview method provided by the embodiment of the application is shown in Figure 10. Figure 10 As shown in Figure 10, the method for determining the corresponding interpolation curve and the number of interpolations is as follows: S1001: Obtain the zoom type (sliding cut), the zoom ratio interval of the current frame, the sliding speed & sliding direction and whether it is a sliding end event; S1002: In the case of sliding cut, according to the zoom ratio interval of the current frame, the sliding speed, the sliding direction and whether it is a sliding end event, the curve & interpolation is adjusted; S1003: Obtain the curve coefficient & interpolation number.
[0108] In zoom-in scenarios, since the FOV changes gradually, there is enough FOV to crop even if the secondary camera doesn't have time to expand its FOV. For zoom-in scenarios, you only need to consider the responsiveness and smoothness of zooming (generally, the sensor can be turned on before zooming stops). For zoom-out scenarios, you need to consider the on / off status of the target secondary camera.
[0109] For zoom-out fast-slide scenarios, if the target's zoom ratio (the latest zoom ratio issued by the camera application) requires pulling up a lower-level sensor (for example, if the current frame is the working range of a telephoto camera, and the target zoom ratio determines that the ultra-wide-angle camera needs to be pulled up), the first step is to determine the on / off status of the ultra-wide-angle camera. If it is already on, then it can be processed according to the curve coefficient determined by the sliding speed and the number of interpolated frames. If the target camera is not pulled up, then the curve should be made slightly flatter, and the number of interpolated frames should be increased (or gradually increased) to ensure that when the FOV moves to the vicinity of the target camera, the target camera can be in normal working condition, avoiding abnormal performance such as FOV stuttering or pullback caused by the FOV changing faster than the sensor's pull-up speed.
[0110] Figure 11 A schematic diagram of an optional mapping curve provided for an embodiment of this application is shown below. Figure 11 As shown, curves 111 and 112 are included. The first column of the table on the left represents the change in zoom ratio for curve 111, and the second column represents the change in zoom ratio for curve 112. For curve 111, the interpolated frames in the early part of the interpolation curve (during the slide) are relatively uniform (the middle part of the zoom curve). When the camera application issues a slide stop event (target zoom ratio), HAL will perform smoothing of the zoom curve and the number of interpolated frames at the end to meet the requirements of tail smoothing (applying separate curve coefficients and interpolation frame number configurations); therefore, it is necessary to issue a stop slide event in a timely manner when the slide end event occurs so as to perform tail interpolation processing in a timely manner.
[0111] It's important to note that when a user is holding down the slider and continuously swiping, the frame interpolation logic cannot be activated to avoid noticeable slow-to-fast transitions or abnormal trailing. Therefore, for scenarios involving holding down and swiping, frame interpolation logic should be applied during swiping.
[0112] In addition, the interpolation logic of the present example requires the upper camera application to no longer perform interpolation processing, and directly issues the obtained zoom ratio to the HAL quickly. In this way, not only can the superfluous load pressure of the camera application side be reduced, but the HAL can also receive the target zoom ratio as soon as possible, trigger the sensor pull-up operation in advance, and overall make the interpolation processing of the HAL more flexible, and also can reduce the interpolation quantity to a certain extent and improve the followability experience of the tail of fast sliding.
[0113] For the case that the sensor pull-up is not timely in the zoom-out fast scene, not only can the balance be achieved through the multiple interpolation and dynamic adjustment of the zoom curve described in the present example, but also the multiple opening interval of the lens can be increased to achieve this purpose; however, this can cause the problem of high power consumption during sliding zoom. The present example dynamically adjusts the curve and interpolation quantity according to the sliding speed, sliding direction, zoom ratio interval where the current frame is located, and tail interpolation event information. Compared with the previous interpolation scheme, the present example has greater flexibility and better FOV change experience.
[0114] In summary, the present example obtains the sliding speed, sliding direction, zoom ratio interval where the current frame is located, and tail interpolation event information of the sliding cut scene, and then dynamically adjusts the interpolation curve and interpolation quantity. Only based on the Bezier curve, the FOV can be changed more smoothly and smoothly. When adjusting the interpolation curve, the present example not only considers the sliding speed, but also adjusts the slope of the curve in combination with the number of frames and the zoom ratio interval where the current frame is located, to avoid the situation that the sliding speed is fast at first and then slow or changes too slowly during sliding.
[0115] Unlike the sliding cut curve and interpolation scheme used in the related art, the present example controls the coefficients of a single Bezier curve and the interpolation quantity based on the sliding speed, sliding direction, zoom ratio interval where the current frame is located, and tail interpolation event information of the sliding cut scene, to achieve smooth change of the zoom curve, avoid burrs or mutations, and provide users with a smoother zoom experience. In addition, the present example no longer needs to perform interpolation processing on the camera application side, and all is performed on the bottom layer, which saves the load of the sliding cut scene and improves the flexibility of sliding cut effect debugging. Earlier issuance of the zoom ratio also provides more time to pull up the target sensor, and there is more room for adjustment of the interpolation quantity.
[0116] The embodiment of the present application provides a kind of image preview method, comprising: receiving and responding to sliding zoom operation, the mapping relationship and the number of frame insertion corresponding to the operation information of sliding zoom operation are determined, the mapping relationship is the mapping relationship between image frame and zoom ratio, based on mapping relationship, the zoom ratio corresponding to the inserted frame when the frame insertion is carried out in the number of frame insertion in the frame insertion position between first zoom ratio and second zoom ratio is determined, according to the zoom ratio corresponding to the inserted frame, current zoom ratio is determined, according to current zoom ratio, the image frame corresponding to current zoom ratio is cropped, and based on the cropped image frame, the current preview picture of current zoom ratio is generated;That is to say, in the embodiment of the present application, the mapping relationship and the number of frame insertion corresponding to the operation information of sliding zoom operation are determined, so that the corresponding relationship between operation information, mapping relationship and the number of frame insertion is set, the appropriate mapping relationship and the number of frame insertion can be determined for different operation information, so that based on mapping relationship, the zoom ratio corresponding to the inserted frame when the frame insertion is carried out in the number of frame insertion in the frame insertion position between first zoom ratio and second zoom ratio can be determined, so that current zoom ratio is determined, the cropped image frame is obtained after cropping, and then the current preview picture is generated, so that the zoom ratio of current preview picture changes with the change of operation information, by setting the corresponding relationship between operation information, mapping relationship and the number of frame insertion, the change of current zoom ratio can be made to present the change of first fast and then slow, and the pull-up state of target camera is considered, so that the preview picture is avoided to be stuck or retracted due to that zoom ratio changes too fast and target camera is not pulled up, and the smoothness of preview picture is improved.
[0117] Based on the same inventive concept as the foregoing embodiments, the embodiment of the present application provides an image preview device, which can be provided in an image preview device, Figure 12 For the structure of an optional image preview device provided by the embodiment of the present application, as shown in Figure 12 The image preview device includes a response module 121, a first determination module 122, a second determination module 123 and a cropping module 124, wherein, The response module 121 is configured to receive and respond to a sliding zoom operation, and determine the mapping relationship and the number of frame insertion corresponding to the operation information of the sliding zoom operation; wherein the mapping relationship is the mapping relationship between the image frame and the zoom ratio. The first determination module 122 is configured to determine, based on the mapping relationship, the zoom ratio corresponding to the inserted frame when the frame insertion is carried out in the number of frame insertion in the frame insertion position between first zoom ratio and second zoom ratio; wherein the first zoom ratio is the initial value of the zoom ratio of the sliding zoom operation; and the second zoom ratio is the zoom ratio to which the sliding zoom operation slides. The second determination module 123 is configured to determine, according to the zoom ratio corresponding to the inserted frame, the current zoom ratio. The clipping module 124 is configured to clip an image frame corresponding to a current zoom ratio according to the current zoom ratio, and generate a current preview picture of the current zoom ratio based on the clipped image frame, wherein the image frame corresponding to the current zoom ratio is an image frame captured by a camera corresponding to a zoom ratio interval in which the current zoom ratio is located.
[0118] In an optional embodiment, the response module 121 determines the mapping relationship and the number of interpolated frames corresponding to the operation information of the sliding zoom operation, including: According to the operation information, attribute feature information of the sliding zoom operation is determined. According to the attribute feature information, the corresponding mapping relationship and the number of interpolated frames are determined.
[0119] In an optional embodiment, the attribute feature information includes at least one of the following: sliding speed, sliding direction, a zoom ratio interval in which the first zoom ratio is located, and whether the sliding zoom operation is a sliding stop event.
[0120] In an optional embodiment, the response module 121 determines the attribute feature information of the sliding zoom operation according to the operation information, including: The first zoom ratio, the second zoom ratio, and the time length of the sliding zoom operation are determined from the operation information. According to the first zoom ratio, the second zoom ratio, and the time length of the sliding zoom operation, the sliding speed is determined.
[0121] In an optional embodiment, the response module 121 determines the attribute feature information of the sliding zoom operation according to the operation information, including: According to the first zoom ratio and the second zoom ratio, the sliding direction is determined.
[0122] In an optional embodiment, the response module 121 determines the attribute feature information of the sliding zoom operation according to the operation information, including: The zoom ratio interval in which the first zoom ratio is located is determined from the zoom ratio interval corresponding to the camera of the electronic device.
[0123] In an optional embodiment, the response module 121 determines the attribute feature information of the sliding zoom operation according to the operation information, including: In the case that the operation information carries a listening event, the sliding zoom operation is determined to be a sliding stop event; wherein the listening event indicates the end of the sliding zoom; In the case that the operation information does not carry a listening event, the sliding zoom operation is determined not to be a sliding stop event.
[0124] In an optional embodiment, the response module 121 determines the corresponding mapping relationship and the number of interpolated frames according to the attribute feature information, including: determine the corresponding coefficient and the number of frames according to the attribute feature information; determine the corresponding Bezier curve according to the coefficient to obtain the corresponding mapping relationship.
[0125] In an optional embodiment, the response module 121 is configured to: The camera application of the electronic device receives and responds to the sliding zoom operation, determines operation information of the sliding zoom operation, and sends the operation information to the HAL of the electronic device. The HAL determines the corresponding mapping relationship and the number of frames according to the operation information of the sliding zoom operation.
[0126] In an optional embodiment, the camera application of the electronic device receives and responds to the sliding zoom operation, determines operation information of the sliding zoom operation, and sends the operation information to the HAL of the electronic device, including: The camera application receives and responds to the sliding zoom operation, determines operation information of the sliding zoom operation at every preset time interval, and sends the operation information to the HAL of the electronic device.
[0127] In an optional embodiment, the first determination module 122 is configured to: the HAL determines, based on the mapping relationship, a zoom ratio corresponding to an inserted frame when frames are inserted at the insertion frame position between the first zoom ratio and the second zoom ratio at the number of insertion frames. The second determination module 123 is configured to: the HAL layer determines the current zoom ratio according to the zoom ratio corresponding to the inserted frame. The cropping module 124 is configured to: the HAL crops the image frame corresponding to the current zoom ratio according to the current zoom ratio, and generates a current preview picture of the current zoom ratio based on the cropped image frame.
[0128] In an optional embodiment, the first determination module 122 is configured to: determine, based on the mapping relationship, a zoom ratio corresponding to an inserted frame when frames are inserted at equal intervals at the position of the insertable frame between the insertion frame position of the first zoom ratio and the second zoom ratio at the number of insertion frames.
[0129] In an optional embodiment, the second determination module 123 is configured to: determine the zoom ratio corresponding to the first frame of the inserted frame as the current zoom ratio.
[0130] In an optional embodiment, the apparatus is further configured to: In the case where the operation information of the sliding zoom operation determines that the sliding zoom operation is a sliding stop event, the secondary camera of the electronic device at the second zoom ratio is turned off.
[0131] In an optional embodiment, the first determining module 122 is configured to: receive and determine the type of the zooming operation in response to the zooming operation. In the case that the type of the zooming operation is the sliding zooming operation, the corresponding mapping relationship and the number of the frame interpolation are determined according to the operation information of the sliding zooming operation.
[0132] In actual application, the response module 121, the first determining module 122, the second determining module 123 and the cropping module 124 can be implemented by a processor on the image preview device, specifically, a CPU, a microprocessor unit (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA) and the like.
[0133] Figure 13 An optional structure schematic diagram of an electronic device provided by the embodiment of the present application is shown in FIG. 13, and the embodiment of the present application provides an electronic device 1300, which comprises: Figure 13 The electronic device 1300 comprises: a processor 131 and a storage medium 132 storing instructions executable by the processor 131; the storage medium 132 performs operations in dependence on the processor 131 through a communication bus 133, and when the instructions are executed by the processor 131, the image preview method of one or more embodiments described above is executed.
[0134] It should be noted that in actual application, various components in the computer device are coupled together through the communication bus 133. It can be understood that the communication bus 133 is used to realize the connection and communication between the components. In addition to the data bus, the communication bus 133 also includes a power bus, a control bus and a state signal bus.
[0135] The embodiment of the present application provides a computer storage medium storing executable instructions, and when the executable instructions are executed by one or more processors, the processor executes the image preview method of one or more embodiments described above.
[0136] The computer readable storage medium can be a ferromagnetic random access memory (FRAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface storage, an optical disc, or a compact disc read-only memory (CD-ROM), and the like.
[0137] Those skilled in the art will understand that embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. In addition, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk memory and optical memory, etc.) including computer-usable program code.
[0138] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as a combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus generate means for implementing the functions specified in one or more flows in the flowcharts and / or one or more blocks in the block diagrams.
[0139] These computer program instructions can also be stored in a computer readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer readable memory produce a product including instruction means, which implements the functions specified in one or more flows in the flowcharts and / or one or more blocks in the block diagrams.
[0140] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operation steps are performed on the computer or other programmable devices to generate computer-implemented processes, thus the instructions executed on the computer or other programmable devices provide steps for implementing the functions specified in one or more flows in the flowchart and / or one or more blocks in the block diagram.
[0141] The above description is only the preferred embodiment of the present application, not for limiting the protection range of the present application.
Claims
1. An image preview method, characterized by, The method comprises: receiving and responding to a sliding zoom operation, determining a mapping relationship and an interpolation number corresponding to operation information of the sliding zoom operation; wherein the mapping relationship is a mapping relationship between image frames and zoom ratios; based on the mapping relationship, determining a zoom ratio corresponding to an inserted frame when interpolation is performed on an interpolation position between a first zoom ratio and a second zoom ratio with the interpolation number; determining a current zoom ratio according to the zoom ratio corresponding to the inserted frame; cropping an image frame corresponding to the current zoom ratio according to the current zoom ratio, and generating a current preview picture of the current zoom ratio based on the cropped image frame.
2. The method of claim 1, wherein, The determining of the mapping relationship and the interpolation number corresponding to the operation information of the sliding zoom operation comprises: determining attribute feature information of the sliding zoom operation according to the operation information; determining the corresponding mapping relationship and interpolation number according to the attribute feature information.
3. The method of claim 2, wherein, The attribute feature information comprises at least one of the following: sliding speed, sliding direction, a zoom ratio interval in which the first zoom ratio is located, and whether the sliding zoom operation is a sliding stop event.
4. The method of claim 3, wherein, The determining of the attribute feature information of the sliding zoom operation according to the operation information comprises: determining the first zoom ratio, the second zoom ratio and the time length of the sliding zoom operation from the operation information; determining the sliding speed according to the first zoom ratio, the second zoom ratio and the time length of the sliding zoom operation.
5. The method of claim 3, wherein, The determining of the attribute feature information of the sliding zoom operation according to the operation information comprises: determining the sliding direction according to the first zoom ratio and the second zoom ratio.
6. The method of claim 3, wherein, The determining of the attribute feature information of the sliding zoom operation according to the operation information comprises: determining the zoom ratio interval in which the first zoom ratio is located from zoom ratio intervals corresponding to the camera of the electronic device.
7. The method of claim 3, wherein, The determining of the attribute feature information of the sliding zoom operation according to the operation information comprises: in the case that the operation information carries a listening event, determining that the sliding zoom operation is a sliding stop event; wherein the listening event indicates the end of the sliding zoom; in the case that the operation information does not carry a listening event, determining that the sliding zoom operation is not a sliding stop event.
8. The method according to any one of claims 2 to 7, characterized in that, The determining of the corresponding mapping relationship and interpolation number according to the attribute feature information comprises: determining a corresponding coefficient and interpolation number according to the attribute feature information; determining a corresponding Bezier curve according to the coefficient to obtain a corresponding mapping relationship.
9. The method of claim 1, wherein, The receiving and responding to the sliding zoom operation, and the determining of the corresponding mapping relationship and interpolation number according to operation information of the sliding zoom operation, comprise: a camera application of an electronic device receives and responds to the sliding zoom operation, determines operation information of the sliding zoom operation, and sends the operation information to a HAL of the electronic device; the HAL determines the corresponding mapping relationship and interpolation number according to the operation information of the sliding zoom operation.
10. The method of claim 9, wherein, The camera application of the electronic device receives and responds to the sliding zoom operation, determines operation information of the sliding zoom operation, and sends the operation information to the HAL of the electronic device, including: The camera application receives and responds to the sliding zoom operation, determines operation information of the sliding zoom operation every preset time interval, and sends the operation information to the HAL of the electronic device.
11. The method of claim 10, wherein, The mapping relationship is determined based on the mapping relationship, and the zoom ratio corresponding to the inserted frame when the frame is inserted at the interpolation position between the first zoom ratio and the second zoom ratio with the interpolation number is determined. The HAL determines the zoom ratio corresponding to the inserted frame based on the mapping relationship when the frame is inserted at the interpolation position between the first zoom ratio and the second zoom ratio with the interpolation number. The current zoom ratio is determined according to the zoom ratio corresponding to the inserted frame, including: The HAL determines the current zoom ratio according to the zoom ratio corresponding to the inserted frame. The current zoom ratio is determined according to the zoom ratio corresponding to the inserted frame, including: The HAL determines the current zoom ratio according to the zoom ratio corresponding to the inserted frame.
12. The method according to any one of claims 1 to 7, characterized in that, The current zoom ratio is determined according to the zoom ratio corresponding to the inserted frame, including: The current zoom ratio is determined according to the zoom ratio corresponding to the inserted frame, including:
13. The method according to any one of claims 1 to 7, characterized in that, The first frame of the inserted frame is determined as the current zoom ratio. The method further comprises:
14. The method according to any one of claims 1 to 7, characterized in that, In the case that the operation information of the sliding zoom operation determines that the sliding zoom operation is a sliding stop event, the second zoom ratio of the electronic device is closed. The receiving and responding to the sliding zoom operation, and determining the corresponding mapping relationship and interpolation number according to the operation information of the sliding zoom operation, include:
15. The method according to any one of claims 1 to 7, characterized in that, Receiving and responding to the zoom operation, determining the type of the zoom operation; In the case that the type of the zoom operation is the sliding zoom operation, the corresponding mapping relationship and interpolation number are determined according to the operation information of the sliding zoom operation. Including:
16. An image preview device, characterized by The response module is configured to receive and respond to the sliding zoom operation, determine the operation information of the sliding zoom operation, and send the operation information to the HAL of the electronic device, including: The first determination module is configured to determine the zoom ratio corresponding to the inserted frame based on the mapping relationship when the frame is inserted at the interpolation position between the first zoom ratio and the second zoom ratio with the interpolation number. The first determination module is configured to determine the zoom ratio corresponding to the inserted frame based on the mapping relationship when the frame is inserted at the interpolation position between the first zoom ratio and the second zoom ratio with the interpolation number. A second determining module, configured to determine a current zoom ratio according to a zoom ratio corresponding to the inserted frame; A cropping module, configured to crop an image frame corresponding to the current zoom ratio according to the current zoom ratio, and generate a current preview picture of the current zoom ratio based on the cropped image frame.
17. An electronic device, comprising: Comprise: A processor and a storage medium having instructions executable by the processor stored therein; The storage medium performs operations in dependence on the processor via a communication bus, and when the instructions are executed by the processor, the image preview method in any one of claims 1 to 15 is performed.
18. A computer storage medium, comprising, The executable instructions are stored, and when the executable instructions are executed by one or more processors, the processor executes the image preview method in any one of claims 1 to 15.