Video cutting method, device, electronic device and storage medium

By receiving parameter values ​​and boundary information of the video picture, the minimum scaling or maximum displacement parameter values ​​are calculated to ensure that the picture to be cropped covers the crop area, solving the problem of black edges after video cropping, and improving the visual effect of video creation.

CN115665347BActive Publication Date: 2024-12-24BEIJING APRIL STAR NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211323918.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-27
Publication Date
2024-12-24
Estimated Expiration
2042-10-27

AI Technical Summary

Technical Problem

During the video creation process, the video screen after rotation, scaling and displacement transformation may no longer be located in the preset area, resulting in black edges after cropping, affecting the visual effect.

Method used

By receiving the parameter values ​​of the video screen, determine the crop area, and calculate the minimum scaling parameter value or the maximum displacement parameter value based on the transformed video screen boundary information to ensure that the picture to be cropped covers the crop area, thereby avoiding the appearance of black edges.

Benefits of technology

Ensure that the cropped video screen does not have black edges, improving the visual effect and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115665347B_ABST
    Figure CN115665347B_ABST
Patent Text Reader

Abstract

The present application proposes a video cropping method, device, electronic device and storage medium, wherein the video cropping method comprises: receiving a first parameter value for transforming a video screen of a target video; determining a cropping area; determining a screen to be cropped based on the video screen transformed by the first parameter value and the cropping area; the screen to be cropped covers the cropping area; and cropping the screen to be cropped based on the cropping area to obtain a cropped video. The embodiment of the present application determines the screen to be cropped based on the cropping area and the transformed video screen after transforming the video screen of the target video based on the first parameter value, and ensures that the screen to be cropped covers the cropping area, so that the cropping area crops the screen to be cropped, and the obtained cropped video will not have black edges.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a video cropping method, device, electronic device and storage medium. Background Art

[0002] When creating videos, it is often necessary to rotate, scale, and shift the original video images to meet personalized needs. After the rotation, scaling, and shift transformation, part of the video may no longer be in the original preset area, so it needs to be cropped. However, the cropped image will have black edges, affecting the visual effect. Summary of the invention

[0003] The embodiments of the present application provide a video cropping method, device, electronic device and storage medium to solve the problems existing in the related technologies. The technical solutions are as follows:

[0004] In a first aspect, an embodiment of the present application provides a video cropping method, comprising:

[0005] Receiving a first parameter value for transforming a video picture of a target video;

[0006] Determine the cropping area;

[0007] Determine the picture to be cropped based on the video picture and the cropping area after the first parameter value is transformed; the picture to be cropped covers the cropping area;

[0008] The image to be cropped is cropped based on the cropping area to obtain a cropped video.

[0009] In one implementation, determining the clipping area includes:

[0010] Determine the cropping area based on the original screen size of the target video; or,

[0011] An edit size is received, and a crop region is determined based on the edit size.

[0012] In one implementation, determining the to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed includes:

[0013] Obtaining boundary information of the video picture after the first parameter value is transformed; and determining whether the video picture after the first parameter value is transformed covers the cropping area based on the boundary information;

[0014] When it is determined that the video picture after the first parameter value is transformed does not cover the cropping area, obtaining a minimum scaling parameter value;

[0015] The video picture transformed by the first parameter value and the minimum scaling parameter value is determined as the picture to be cropped.

[0016] In one implementation, determining the to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed includes:

[0017] Obtaining boundary information of the video picture after the first parameter value is transformed; and determining whether the video picture after the first parameter value is transformed covers the cropping area based on the boundary information;

[0018] In the case where it is determined that the video picture after the first parameter value is transformed covers the cropping area, the video picture after the first parameter value is transformed is determined as the picture to be cropped.

[0019] In one embodiment, it further includes:

[0020] Determine a first parameter threshold for transforming the video picture based on the video picture and the cropped area after the first parameter value is transformed;

[0021] Receiving a second parameter value for transforming a video picture;

[0022] When the second parameter value exceeds the first parameter threshold, it is determined that the video picture transformed by the first parameter threshold is used as the video picture after the second parameter value is transformed.

[0023] In one embodiment, it further includes:

[0024] When the second parameter value does not exceed the first parameter threshold, determine to transform the video picture with the second parameter value;

[0025] Based on the cropped area and the video picture after the second parameter value is transformed, a second parameter threshold for transforming the video picture is determined.

[0026] In one implementation, the process of determining the to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed further includes:

[0027] receiving an adaptive request, where the adaptive request is used to determine whether it is necessary to determine a to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed;

[0028] When the adaptive request is determined to be no, the video picture after the first parameter value is transformed is cropped based on the cropping area to obtain a cropped video.

[0029] In a second aspect, an embodiment of the present application provides a video cropping device, including:

[0030] A first parameter value receiving module, used for receiving a first parameter value for transforming a video picture of a target video;

[0031] A cropping region determination module, used for determining a cropping region;

[0032] A module for determining a picture to be cropped, used to determine the picture to be cropped based on the video picture and the cropping area after the first parameter value is transformed; the picture to be cropped covers the cropping area;

[0033] The cropping module is used to crop the image to be cropped based on the cropping area to obtain a cropped video.

[0034] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor so that the at least one processor can execute the video cropping method of any one of the above-mentioned aspects.

[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the video cropping method in any one of the above-mentioned embodiments is executed.

[0036] The advantages or beneficial effects of the above technical solution include at least:

[0037] In the embodiment of the present application, after transforming the video picture of the target video based on the first parameter value, the picture to be cropped is determined according to the cropping area and the transformed video picture, and it is ensured that the picture to be cropped covers the cropping area, so that the cropping area crops the picture to be cropped, and the obtained cropped video will not have black edges.

[0038] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.

[0040] Figure 1 is an exemplary system architecture diagram to which the present application can be applied.

[0041] Figure 2 FIG. 4 is a flow chart of a video cropping method according to an embodiment of the present application.

[0042] Figure 3 FIG. 4 is a flow chart of a method for determining a picture to be cropped according to an embodiment of the present application.

[0043] Figure 4 FIG. 4 is a geometric diagram of determining a minimum scaling parameter value according to an embodiment of the present application.

[0044] Figure 5 FIG. 4 is another geometric diagram of determining a minimum scaling parameter value according to an embodiment of the present application.

[0045] Figure 6 FIG. 4 is a geometric diagram of determining a maximum position parameter value according to an embodiment of the present application.

[0046] Figure 7 FIG. 4 is a schematic block diagram of a video cropping device according to an embodiment of the present application.

[0047] Figure 8 It is a block diagram of an electronic device used to implement the video cropping method of an embodiment of the present application. DETAILED DESCRIPTION

[0048] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.

[0049] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0050] The following is an explanation of the names involved in this application:

[0051] Video template: A template used for video editing, which can perform transformation effects such as rotation, scaling, and displacement on the target video to achieve the attribute effects of the video template.

[0052] Cropping area: an area used to crop the video screen of the target video. In the video screen, the screen within the cropping area is retained, and the screen outside the cropping area is cropped.

[0053] Image to be cropped: The object used to perform the cropping operation. If the image to be cropped covers the cropping area, the cropped video will not have black edges.

[0054] In order to facilitate those skilled in the art to understand the technical solutions provided by the embodiments of the present application, the relevant technologies are described below:

[0055] When using video templates to crop video images, black edges often appear. That is, after the video image is rotated, scaled, and displaced, there is no video image in the area of ​​the video template. After cropping, black edges will appear, affecting the video creation effect and reducing the user experience.

[0056] In view of the above, the embodiment of the present application provides a new video cropping solution, which can be used to solve the above problems. In this video cropping solution, in order to prevent the cropped video from having black edges after cropping, it is necessary to ensure that the video screen covers the cropping area; the parameter thresholds when the video screen is rotated, scaled, displaced, etc. are determined by a preset function, so that the transformation within the parameter threshold can ensure that the cropping area is within the video screen, so that there will be no black edges. For example: after the video screen is rotated by a certain angle, the minimum scaling parameter value of the video screen can be determined by the trigonometric function relationship, so that the video screen is changed according to the minimum scaling parameter value, so that the cropping area is within the video screen. At this time, the video screen can be enlarged. After enlargement, the cropping area is within the video screen and there is a gap with the video screen. The maximum displacement parameter value and the minimum scaling parameter value that the video screen can be transformed can be determined by the distance between the center point of the cropping area and the high side or wide side of the video screen, and the video screen is kept within the large displacement parameter value or the minimum scaling parameter value. Transformation to keep the cropping area always within the video screen.

[0057] The following is an exemplary application environment diagram of the present application: Figure 1 As shown, the exemplary application environment diagram provides a system architecture 100, which may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0058] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0059] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.

[0060] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0061] It should be noted that the video cropping method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the video cropping device is generally arranged in the server / terminal device.

[0062] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0063] Figure 2 FIG. 2 is a flow chart showing a method for cutting out a video according to an embodiment of the present application. Figure 2 As shown, the video cropping method may include:

[0064] Step S210: receiving a first parameter value of a video frame of a target video to be transformed.

[0065] In an embodiment of the present application, the first parameter value may be any parameter value of a displacement parameter, a rotation parameter, or a scaling parameter. The first parameter value is used to indicate the transformation of the video screen of the target video to meet the personalized needs of the user. For example, if the first parameter value is a rotation of 30°, it means that the video screen of the target video will be rotated 30° clockwise around the center point of the video screen. If the rotation angle value is a negative number, it indicates a counterclockwise rotation. For another example, if the first parameter value is a zoom of 1.5 times, it means that the video screen of the target video is enlarged to 1.5 times the video screen. If the zoom multiple is greater than 1, it means that the video screen is enlarged; conversely, if the zoom multiple is less than 1, it means that the video screen is reduced.

[0066] In an embodiment of the present application, the first parameter value can be a first parameter value formed by a user dragging the video screen of the target video on the terminal device 101, 102, 103, or it can be a first parameter value formed by a parameter value configured by the user in the parameter configuration interface of the terminal device 101, 102, 103.

[0067] In the embodiment of the present application, the first parameter value may be the parameter value used by the user to change the video screen of the target video for the first time; or it may be the parameter value used by the user to change the video screen for the Nth time, where N is a positive integer.

[0068] In the embodiment of the present application, the target video may be obtained by uploading by a user, may be stored in a video cropping system, or may be obtained by establishing a link with other platforms.

[0069] In one example, a corresponding threshold value may be set for the first parameter value. For example, the threshold value of the rotation parameter may be set to -45° to 45°; the threshold value of the displacement parameter may be set to the size of the cropping area, where the size of the cropping area is width W and height H; the threshold value of the displacement parameter may be set to a width displacement of -W to W and a height displacement of -H 1 to H; the threshold value of the scaling parameter may be set to -5 to 5 times.

[0070] By setting a corresponding threshold value for the first parameter value, it is possible to avoid the user from making an excessive transformation to the target video when performing a transformation operation, thereby affecting the picture effect of the target video, or to avoid excessive transformation caused by a user's manual error.

[0071] Step S220, determining the cropping area.

[0072] In the embodiment of the present application, the cropping area may be a default cropping area, or a cropping area selected according to the personalized needs of the user. The default cropping area may be a cropping area of ​​a fixed ratio and a fixed size, or may be a region determined according to the received target video to have the same size, ratio and position as the received target video as the cropping area. The default cropping area may be set according to the specific application.

[0073] In one example, the default cropping area may be determined according to a user's configured option.

[0074] In one example, a cropping area may be generated based on an area of ​​a specific size and ratio selected by a user or a template selected by a user. For example, a template selected by a user is a 6:9 screen size; based on the template, a cropping area corresponding to the screen size is displayed in the interface display area.

[0075] In one example, the cropping area may be determined according to a selected video template.

[0076] In the embodiment of the present application, the cropping area is used to determine the screen area of ​​the cropped video obtained after cropping the target video. That is, the video screen falling within the cropping area will generate a cropped video, which can be seen when playing the cropped video.

[0077] Step S230, determining a picture to be cropped based on the video picture after the first parameter value is transformed and the cropping area; the picture to be cropped covers the cropping area.

[0078] The terminal devices 101, 102, and 103 may have an interface display area for displaying the video screen or the cropped area of ​​the target video.

[0079] In the embodiment of the present application, when the first parameter value is received, the video picture of the target video is changed accordingly, and the picture to be cropped is determined in real time based on the cropping area, so that when cropping, it can be ensured that the picture to be cropped covers the cropping area.

[0080] In one example, after the target video is transformed based on the first parameter value, the interface display area will not display the video screen of the target video after the transformation based on the first parameter value, but will display the video screen after the transformation based on the first parameter value and the screen to be cropped determined by the cropping area. This can make the video screen seen by the user cover the cropping area, making the picture effect more beautiful and intuitive, and can also avoid the user's illusion that black edges will appear after cropping the video.

[0081] By displaying the image to be cropped and the cropping area in the interface display area, the user can conveniently preview whether the video image content cropped in the cropping area meets the expected needs.

[0082] Step S240, cropping the image to be cropped based on the cropping area to obtain a cropped video.

[0083] In the embodiment of the present application, the image to be cropped is cropped based on the cropping area, and the cropping can be performed after receiving information confirming the cropping to ensure that the cropped video is the video required by the user.

[0084] In an exemplary application scenario, after the user transforms the first parameter value, the obtained video to be cropped already satisfies the problem of no black edges after cropping, but the user may want to make further adjustments based on the video to be cropped, and will not confirm the cropping until the picture to be cropped displayed in the interface display area is a satisfactory picture after being cropped in the cropping area.

[0085] In one example, after receiving the information confirming the cropping, the cropped video preview can be automatically played to facilitate the user to browse whether the video images of the cropped video are all ideal video images. When receiving the information for generating the cropped video, the cropped video is generated to facilitate the user to save.

[0086] In the embodiment of the present application, after transforming the video picture of the target video based on the first parameter value, the picture to be cropped is determined according to the cropping area and the transformed video picture, and it is ensured that the picture to be cropped covers the cropping area, so that the cropping area crops the picture to be cropped, and the obtained cropped video will not have black edges.

[0087] In one implementation, step S220 includes: determining the cropping area based on the original size of the target video; or receiving an edited size and determining the cropping area based on the edited size.

[0088] In an example, the original screen size of the target video is W in width and H in height; the size of the cropping area is also determined to be W in width and H in height; and the position of the cropping area is the same as that of the target video.

[0089] In an example, the editing size may be a preset regular ratio size selected by the user, representing a video screen of a specific size, such as a screen size of 4:9; or may be parameter information such as the width and height of the cropping area input by the user.

[0090] In one example, the user selects a video module, and the size of the cropped area is determined according to the screen size specified in the video template.

[0091] Usually, after the size of the cropping area is obtained, the center point of the cropping area is overlapped with the center point of the target video in the interface display area to facilitate cropping of the target video.

[0092] In one embodiment, Figure 3 As shown, step S230 includes:

[0093] Step S231, obtaining boundary information of the video picture after the first parameter value is transformed.

[0094] Step S232: determining whether the video image after the first parameter value is transformed covers the cropping area based on the boundary information.

[0095] Step S233, when it is determined that the video picture after the first parameter value is transformed does not cover the cropping area, obtaining a minimum scaling parameter value;

[0096] Step S234: determine the video picture transformed by the first parameter value and the minimum scaling parameter value as the picture to be cropped.

[0097] In an example, when the original picture size of the target video is width W and height H, the size of the cropped area is the same as the original picture size, and the first parameter value is a rotation of A°, based on the boundary information of the video picture after the first parameter value is transformed, it can be determined that the video picture after the first parameter value is transformed does not cover the cropped area.

[0098] The boundary information of the video picture after the first parameter value is transformed may be coordinate information of four vertices of the video picture.

[0099] In one example, when the cropping area 120 is obtained, the center point of the cropping area 120 coincides with the original center position of the target video, and the vertex coordinates of the cropping area 120 and the target video are obtained respectively with the center point as the origin; according to the information of the first parameter value, the vertex coordinates of the video screen after the first parameter value is transformed are calculated. Thus, the boundary information of the video screen after the first parameter value is transformed is obtained according to the vertex coordinate information.

[0100] Based on the vertex coordinate information of the cropping area and the vertex coordinate information of the video picture after the first parameter value is transformed, it can be determined whether the video picture after the first parameter value is transformed covers the cropping area.

[0101] After the target video image is rotated by A°, it does not cover the cropping area. Therefore, the video image after the first parameter value transformation (rotation by A°) needs to be enlarged again to ensure that the target video image covers the cropping area 120.

[0102] like Figure 4 and Figure 5 As shown, the original screen size of the target video is width W, height H, the size of the cropped area is the same as the original screen size, and when the first parameter value is rotated A°, the interface display area 200 displays the screen to be cropped 110 and the cropped area 120. Target W is the target width of the video screen after the first parameter value is transformed and then scaled a certain multiple to cover the cropped area 120; target H is the target height of the video screen after the first parameter value is transformed and then scaled a certain multiple to cover the cropped area 120. Then:

[0103] target W=W×cos A+H×sin A

[0104] target H=H×cos A+W×sin A

[0105] In order to achieve the target width, the minimum scaling factor is In order to reach the target height, the minimum scaling factor is Therefore, in order to achieve the target width and target height at the same time, so that the enlarged video image can cover the cropping area 120, the minimum scaling parameter value required for scaling is determined to be

[0106] Determining the video picture transformed by the first parameter value and the minimum scaling parameter value as the picture to be cropped 110 can ensure that the picture to be cropped 110 covers the cropping area 120 .

[0107] In one embodiment, Figure 3 As shown, step S230 includes:

[0108] Step S231, obtaining boundary information of the video picture after the first parameter value is transformed.

[0109] Step S232: determining whether the video image after the first parameter value is transformed covers the cropping area based on the boundary information.

[0110] Step S235 : when it is determined that the video picture after the first parameter value is transformed covers the cropping area, the video picture after the first parameter value is transformed is determined as a picture to be cropped.

[0111] In one example, if Figure 6 As shown, the original screen size of the target video is width W and height H, and the size of the cropping area is the same as the original screen size. After the user rotates the video screen of the target video by A°, it is scaled by B (B is greater than 1), and the interface display area 200 displays the to-be-cropped screen 110 and the cropping area 120. When the user rotates the video screen of the target video by A°, the to-be-cropped screen covers the cropping area, and the video screen is scaled times, that is, after the rotation of A°, the width of the video screen is The height of the video screen is At this time, if the video image is scaled B times and B is greater than 1, the video image is further scaled up on this basis, and the scaled-up video image is determined to cover the cropping area, and there is still a distance between the cropping area and the boundary of the video image. The video image transformed by the first parameter value is determined to be the image to be cropped 110, which can ensure that the image to be cropped covers the cropping area. In this case, when the cropping area 120 crops the video image after the first parameter value is transformed, no black border will appear, and the user can continue to shift or scale the video image within the boundary range.

[0112] In one implementation, in step S235, when it is determined that the video picture after the first parameter value is transformed covers the cropping area, the method further includes:

[0113] Determine a first parameter threshold for transforming the video picture based on the video picture and the cropped area after the first parameter value is transformed;

[0114] Receiving a second parameter value for transforming a video picture;

[0115] When the second parameter value exceeds the first parameter threshold, it is determined that the video picture transformed by the first parameter threshold is used as the video picture after the second parameter value is transformed.

[0116] In the above example, if Figure 6As shown, the original screen size of the target video is width W, height H, the size of the cropped area is the same as the original screen size, the first parameter value is rotation A°, and magnification B times, and the to-be-cropped screen 110 is obtained after being magnified B times. However, the user may want to adjust the video screen on this basis, for example, want to shift, scale or rotate the video screen, and then enter the second parameter value.

[0117] In order to ensure that the video picture transformed based on the second parameter value covers the cropping area, the maximum displacement value of the video picture can also be shifted: the distance from the center point P of the cropping area 120 to the wide side of the video picture (t1 or t2) is greater than or equal to And the distance (t3 or t4) from the center point P of the cropping area 12 to the high side of the video screen is greater than or equal to That is, the maximum distance that can be moved in the wide side direction Or move the maximum distance towards the high side A positive distance indicates movement to the right or upward, and a negative distance indicates movement to the left or downward.

[0118] In the embodiment of the present application, the distance from the center point P of the cropping area 120 to the wide side (t1 or t2) or the high side (t3 or t4) of the video screen can be obtained by the distance calculation formula from a point to a straight line.

[0119] In the present application embodiment, Figure 6 As shown, the distance from the center point P of the cropped area 120 to the width side of the video screen of the transformed target video (t1 or t2) refers to the distance from the center point P of the cropped area 120 to the two width sides of the video screen 110; the distance from the center point P of the cropped area 120 to the height side of the video screen of the transformed target video (t3 or t4) refers to the distance from the center point P of the cropped area 120 to the two height sides of the video screen.

[0120] In the above example, after the user rotates the target video by A° and zooms it in by B times, the minimum zoom parameter value that can be zoomed in is 1 / B times, that is, the zoom threshold parameter is greater than or equal to 1 / B.

[0121] When the second parameter value does not exceed the first parameter threshold, the video picture transformed by the second parameter value is determined as the video picture after the second parameter value transformation. That is, the video picture of the target video transformed by the second parameter value still meets the requirement of covering the cropping area, and the video picture of the target video transformed by the second parameter value can be determined as the picture to be cropped.

[0122] When the second parameter value exceeds the first parameter threshold, the video picture transformed by the first parameter threshold is determined as the video picture transformed by the second parameter value. Exemplarily, if the second parameter value is reduced by 1 / (B+1) times, only the reduction by 1 / B times is performed, and the video picture reduced by 1 / B times is displayed as the picture to be cropped.

[0123] In the embodiment of the present application, the second parameter value used to transform the video picture is limited by the first parameter threshold, thereby ensuring that the video picture after the second parameter value is transformed covers the cropping area.

[0124] In one embodiment, it further includes:

[0125] When the second parameter value does not exceed the first parameter threshold, determine to transform the video picture with the second parameter value;

[0126] Based on the cropped area and the video picture after the second parameter value is transformed, a second parameter threshold for transforming the video picture is determined.

[0127] For example, the original screen size of the target video is W in width and H in height, and the size of the cropped area is the same as the original screen size. The user rotates the target video by A°, enlarges it by B times, and moves it rightward by S. The range of S is: After the video image moves rightward by S, the minimum scalable scaling parameter value and the maximum displacement distance need to be re-determined, so that the video image moves within the second parameter threshold range, and the video image can be ensured to cover the cropping area.

[0128] In the embodiment of the present application, after the user rotates the target video by A° and enlarges it by B times, or after the user rotates the target video by A°, enlarges it by B times, and moves it to the right by S, the user may further perform a rotation operation.

[0129] In one example, the rotation parameter threshold is set to 0° to 45°; the user can operate the video screen to rotate any angle from 0° to 45°, and the rotation angle will not be limited according to the boundary information of the video screen. When the video screen is rotated by a certain angle, resulting in the video screen not covering the cropped area, the video screen is adaptively enlarged by obtaining the minimum zoom parameter value to ensure that the video screen covers the cropped area.

[0130] In the embodiment of the present application, the video screen is rotated based on a certain angle, which is based on the center of the video.

[0131] The first parameter value and the second parameter value in the embodiment of the present application are not limited to variable parameters of displacement parameters, scaling parameters and rotation parameters; they may also include variable parameters that may be used in the future to transform video images.

[0132] In one implementation, before step S230, the method further includes:

[0133] receiving an adaptive request, where the adaptive request is used to determine whether it is necessary to determine a to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed;

[0134] When the adaptive request is determined to be no, the video picture after the first parameter value is transformed is cropped based on the cropping area to obtain a cropped video.

[0135] The embodiment of the present application confirms whether the user needs to satisfy the situation that the cropped video does not include black edges by receiving an adaptive request. If the adaptive request is determined to be no, the video picture after the first parameter value is transformed is cropped based on the cropping area to obtain a cropped video, and black edges may appear in the cropped video. If the adaptive request is determined to be yes, after receiving the first parameter value, the picture to be cropped is determined based on the video picture after the first parameter value is transformed and the cropping area, so that the video picture after the first parameter value is transformed is cropped based on the cropping area to obtain a cropped video, and it is ensured that no black edges appear in the cropped video.

[0136] In the embodiment of the present application, whether the target video needs to be adaptively transformed can be selected through configuration.

[0137] Figure 7 FIG. 8 is a structural block diagram of a video cropping device 800 according to an embodiment of the present application. Figure 7 As shown, the video cropping device 800 may include:

[0138] A first parameter value receiving module 810 is used to receive a first parameter value for transforming a video picture of a target video;

[0139] A cropping region determining module 820, configured to determine a cropping region;

[0140] The to-be-cropped picture determination module 830 is used to determine the to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed; the to-be-cropped picture covers the cropping area;

[0141] The cropping module 840 is used to crop the image to be cropped based on the cropping area to obtain a cropped video.

[0142] In one implementation, the cropping region determination module 820 is used to:

[0143] Determine the cropping area based on the original screen size of the target video; or,

[0144] An edit size is received, and a crop region is determined based on the edit size.

[0145] In one implementation, the to-be-cropped picture determination module 830 includes:

[0146] A boundary information acquisition module, used to acquire boundary information of the video picture after the first parameter value is transformed; based on the boundary information, determine whether the video picture after the first parameter value is transformed covers the cropping area;

[0147] A minimum zoom parameter value acquisition module, used to obtain the minimum zoom parameter value when it is determined that the video picture after the first parameter value is transformed does not cover the cropping area;

[0148] The to-be-cropped picture determination module 830 is used to determine the video picture transformed by the first parameter value and the minimum scaling parameter value as the to-be-cropped picture.

[0149] In one implementation, the to-be-cropped picture determination module 830 includes:

[0150] A boundary information acquisition module, used to acquire boundary information of the video picture after the first parameter value is transformed; based on the boundary information, determine whether the video picture after the first parameter value is transformed covers the cropping area;

[0151] The to-be-cropped picture determination module 830 is used to determine the video picture after the first parameter value is transformed as the to-be-cropped picture when it is determined that the video picture after the first parameter value is transformed covers the cropping area.

[0152] In one implementation, the video cropping device 800 further includes:

[0153] A first parameter threshold determination module, used to determine a first parameter threshold for transforming the video picture based on the video picture and the cropped area after the first parameter value is transformed;

[0154] A second parameter value receiving module, used for receiving a second parameter value for transforming a video picture;

[0155] The video conversion module is used to determine to convert the video picture according to the first parameter threshold value when the second parameter value exceeds the first parameter threshold value.

[0156] In one implementation, the video cropping device 800 further includes: a second parameter threshold determination module, configured to determine a second parameter threshold for transforming the video picture based on the cropped area and the video picture transformed by the second parameter value.

[0157] In one implementation, the video cropping device 800 further includes:

[0158] An adaptive request receiving module, used for receiving an adaptive request, wherein the adaptive request is used for determining whether it is necessary to determine a to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed;

[0159] The cropping module 840 is used to crop the video picture after the first parameter value is transformed based on the cropping area to obtain a cropped video when the adaptive request is determined to be no.

[0160] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and will not be repeated here.

[0161] Figure 8 FIG. 1 is a block diagram showing a structure of an electronic device according to an embodiment of the present application. Figure 8 As shown, the electronic device includes: a memory 910 and a processor 920, and the memory 910 stores instructions that can be run on the processor 920. When the processor 920 executes the instruction, the video cropping method in the above embodiment is implemented. The number of the memory 910 and the processor 920 can be one or more. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples, and are not intended to limit the implementation of the present application described and / or required herein.

[0162] The electronic device may also include a communication interface 930 for communicating with external devices and performing data exchange transmission. The various devices are interconnected using different buses and may be installed on a common motherboard or in other ways as needed. The processor 920 may process instructions executed within the electronic device, including instructions stored in or on a memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to an interface). In other embodiments, if necessary, multiple processors and / or multiple buses may be used together with multiple memories and multiple memories. Similarly, multiple electronic devices may be connected, each device providing some of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). The bus may be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0163] Optionally, in a specific implementation, if the memory 910, the processor 920 and the communication interface 930 are integrated on a chip, the memory 910, the processor 920 and the communication interface 930 can communicate with each other through an internal interface.

[0164] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting an advanced RISC machines (ARM) architecture.

[0165] An embodiment of the present application provides a computer-readable storage medium (such as the memory 910 described above), which stores computer instructions. When the program is executed by a processor, the method provided in the embodiment of the present application is implemented.

[0166] Optionally, the memory 910 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device for video cropping, etc. In addition, the memory 910 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 910 may optionally include a memory remotely arranged relative to the processor 920, and these remote memories may be connected to the electronic device for video cropping via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0167] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0168] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0169] Any process or method description in the flow chart or otherwise described herein can be understood to represent a module, fragment or portion of a code including one or more (two or more) executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.

[0170] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.

[0171] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.

[0172] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.

[0173] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A video cropping method, characterized in that: include: Receiving a first parameter value for transforming a video picture of a target video; Determine the cropping area; Determine a picture to be cropped based on the video picture after the first parameter value is transformed and the cropping area; The image to be cropped covers the cropping area; Cropping the image to be cropped based on the cropping area to obtain a cropped video; The step of determining the picture to be cropped based on the video picture transformed by the first parameter value and the cropping area includes: Acquire boundary information of the video picture after the first parameter value is transformed; based on the boundary information, determine whether the video picture after the first parameter value is transformed covers the cropping area; In a case where it is determined that the video picture after the first parameter value is transformed covers the cropping area, determining the video picture after the first parameter value is transformed as the picture to be cropped; The method further comprises: Based on the video picture after the first parameter value is transformed and the cropped area, determining a first parameter threshold for transforming the video picture; the first parameter threshold includes a minimum scaling parameter value and / or a maximum movable distance; Receiving a second parameter value for transforming a video picture; When the second parameter value exceeds the first parameter threshold, it is determined that the video picture transformed by the first parameter threshold is used as the video picture after the second parameter value is transformed.

2. The method according to claim 1, characterized in that: Determining the clipping area includes: Determine a cropping area based on the original screen size of the target video; or, An edit size is received, and a crop region is determined based on the edit size.

3. The method according to claim 1, characterized in that The step of determining the picture to be cropped based on the video picture transformed by the first parameter value and the cropping area includes: Acquire boundary information of the video picture after the first parameter value is transformed; based on the boundary information, determine whether the video picture after the first parameter value is transformed covers the cropping area; When it is determined that the video picture after the first parameter value is transformed does not cover the cropping area, obtaining a minimum scaling parameter value; A video picture transformed by using the first parameter value and the minimum scaling parameter value is determined as the picture to be cropped.

4. The method according to claim 1, characterized in that: Also includes: When the second parameter value does not exceed the first parameter threshold, determine to transform the video picture according to the second parameter value; Based on the cropped area and the video picture after the second parameter value is transformed, a second parameter threshold for transforming the video picture is determined.

5. The method according to any one of claims 1 to 4, characterized in that: The determining of the to-be-cropped picture based on the video picture transformed by the first parameter value and the cropping area also includes: receiving an adaptive request, wherein the adaptive request is used to determine whether it is necessary to determine a to-be-cropped picture based on the video picture after the first parameter value is transformed and the cropping area; When the adaptive request is determined to be no, the video picture after the first parameter value is transformed is cropped based on the cropping area to obtain a cropped video.

6. A video cutting device, characterized in that: include: A first parameter value receiving module, used for receiving a first parameter value for transforming a video picture of a target video; A cropping region determination module, used for determining a cropping region; A module for determining a picture to be cropped, configured to determine a picture to be cropped based on the video picture after the first parameter value is transformed and the cropping area; The image to be cropped covers the cropping area; A cropping module, used for cropping the image to be cropped based on the cropping area to obtain a cropped video; The to-be-cropped picture determination module comprises: A boundary information acquisition module, used to acquire boundary information of the video picture after the first parameter value is transformed; based on the boundary information, determine whether the video picture after the first parameter value is transformed covers the cropping area; The to-be-cropped picture determination module is used to determine that the video picture after the first parameter value is transformed is the to-be-cropped picture when it is determined that the video picture after the first parameter value is transformed covers the cropping area; The video cutting device also includes: A first parameter threshold determination module, used to determine a first parameter threshold for transforming the video picture based on the video picture and the cropped area after the first parameter value is transformed; the first parameter threshold includes a minimum scaling parameter value and / or a maximum movable distance; A second parameter value receiving module, used for receiving a second parameter value for transforming a video picture; The video conversion module is used to determine to convert the video picture according to the first parameter threshold value when the second parameter value exceeds the first parameter threshold value.

7. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.

9. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the steps of the method described in any one of claims 1 to 5 are implemented.