CN115665347A - Video clipping method and device, electronic equipment and storage medium - Google Patents
Video clipping method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN115665347A CN115665347A CN202211323918.0A CN202211323918A CN115665347A CN 115665347 A CN115665347 A CN 115665347A CN 202211323918 A CN202211323918 A CN 202211323918A CN 115665347 A CN115665347 A CN 115665347A
- Authority
- CN
- China
- Prior art keywords
- video
- picture
- parameter value
- determining
- cut
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 230000009466 transformation Effects 0.000 claims abstract description 52
- 230000015654 memory Effects 0.000 claims description 20
- 230000003044 adaptive effect Effects 0.000 claims description 7
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 239000000126 substance Substances 0.000 claims 1
- 238000006073 displacement reaction Methods 0.000 description 14
- 238000010586 diagram Methods 0.000 description 9
- 230000006870 function Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 4
- 230000033001 locomotion Effects 0.000 description 3
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000001131 transforming effect Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000000844 transformation Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/2343—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4402—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/222—Studio circuitry; Studio devices; Studio equipment
- H04N5/262—Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Image Processing (AREA)
Abstract
The application provides a video clipping method, a video clipping device, an electronic device and a storage medium, wherein the video clipping method comprises the following steps: receiving a first parameter value of a video picture of a transformation target video; determining a cutting area; determining a picture to be cut based on the video picture and the cutting area after the first parameter value is transformed; covering a cutting area by a picture to be cut; and cutting the picture to be cut based on the cutting area to obtain a cut video. According to the method and the device, after the video picture of the target video is transformed based on the first parameter value, the picture to be cut is determined according to the cutting area and the transformed video picture, and the picture to be cut covers the cutting area, so that the picture to be cut is cut in the cutting area, and the obtained cut video does not have black edges.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a video cropping method and apparatus, an electronic device, and a storage medium.
Background
When video creation is performed, operations such as rotation, scaling, displacement and the like are often required to be performed on an original video picture so as to meet personalized requirements. After the video is rotated, scaled and shifted, a part of the picture may no longer be located in the original preset region, so that clipping is required. However, the cut picture has black edges and the like, which affects the visual effect.
Disclosure of Invention
The embodiment of the application provides a video clipping method, a video clipping device, electronic equipment and a storage medium, which are used for solving the problems in the related art, and the technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a video cropping method, including:
receiving a first parameter value of a video picture of a transformation target video;
determining a cutting area;
determining a picture to be cut based on the video picture and the cutting area after the first parameter value is transformed; covering a cutting area by a picture to be cut;
and cutting the picture to be cut based on the cutting area to obtain a cut video.
In one embodiment, determining the cropping area comprises:
determining a cutting area based on the original picture size of the target video; alternatively, the first and second liquid crystal display panels may be,
receiving an edit size, and determining a cropping area based on the edit size.
In one embodiment, determining a picture to be cropped based on the video picture and the cropping area after the first parameter value is transformed includes:
acquiring boundary information of a video picture after the first parameter value is transformed; determining whether the video picture after the first parameter value transformation covers the cutting area or not based on the boundary information;
under the condition that the video picture after the first parameter value transformation does not cover the cutting area, obtaining a minimum scaling parameter value;
and determining the video picture which is jointly transformed by the first parameter value and the minimum scaling parameter value as a picture to be cut.
In one embodiment, determining a picture to be cropped based on the video picture and the cropping area after the first parameter value is transformed includes:
acquiring boundary information of the video picture after the first parameter value is transformed; determining whether the video picture after the first parameter value transformation covers the cutting area or not based on the boundary information;
and under the condition that the video picture after the first parameter value transformation covers the cutting area, determining that the video picture after the first parameter value transformation is a picture to be cut.
In one embodiment, the method further comprises:
determining a first parameter threshold value of a transformed video picture based on the video picture and the cutting area after the first parameter value is transformed;
receiving a second parameter value of the transformed video picture;
and under the condition that the second parameter value exceeds the first parameter threshold value, determining that the video picture is converted by the first parameter threshold value as the video picture after the second parameter value is converted.
In one embodiment, the method further comprises:
determining to transform the video picture with the second parameter value if the second parameter value does not exceed the first parameter threshold;
and determining a second parameter threshold value of the transformed video picture based on the video picture after the cropping area and the second parameter value transformation.
In one embodiment, determining a picture to be cropped based on the video picture and the cropping area after the first parameter value is transformed further includes:
receiving a self-adaptive request, wherein the self-adaptive request is used for determining whether a picture to be cut needs to be determined based on the video picture and the cutting area after the first parameter value is transformed;
and under the condition that the self-adaption request is determined to be negative, the video picture after the first parameter value transformation is cut based on the cutting area, and a cut video is obtained.
In a second aspect, an embodiment of the present application provides a video cropping device, including:
the first parameter value receiving module is used for receiving a first parameter value of a video picture of a transformation target video;
the cutting area determining module is used for determining a cutting area;
the to-be-cut picture determining module is used for determining a to-be-cut picture based on the video picture and the cutting area after the first parameter value is converted; covering a cutting area by a picture to be cut;
and the cutting module is used for cutting the picture to be cut based on the cutting area to obtain a cut video.
In a third aspect, an embodiment of the present application provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the video cropping method of any of the above aspects.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, which stores computer instructions, and when the computer instructions are executed on a computer, the video cropping method in any one of the above-mentioned aspects is executed.
The advantages or beneficial effects in the above technical solution at least include:
according to the method and the device, after the video picture of the target video is transformed based on the first parameter value, the picture to be cut is determined according to the cutting area and the transformed video picture, and the picture to be cut covers the cutting area, so that the picture to be cut is cut in the cutting area, and the obtained cut video does not have black edges.
The foregoing summary is provided for the purpose of description 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 drawings and following detailed description.
Drawings
In the drawings, like reference numerals refer to the same or similar parts or elements throughout the several views unless otherwise specified. The figures are not necessarily to scale. It is appreciated that these drawings depict only some embodiments in accordance with the disclosure and are therefore not to be considered limiting of its scope.
FIG. 1 is an exemplary system architecture diagram to which the present application may be applied.
Fig. 2 is a flowchart illustrating a video cropping method according to an embodiment of the present application.
Fig. 3 is a flowchart illustrating a method for determining a frame to be cropped according to an embodiment of the present application.
FIG. 4 is a geometric diagram illustrating the determination of minimum scaling parameter values according to an embodiment of the present application.
FIG. 5 is another geometric diagram illustrating the determination of a minimum scaling parameter value according to an embodiment of the present application.
FIG. 6 is a geometric schematic diagram of determining a maximum position parameter value according to an embodiment of the present application.
FIG. 7 is a schematic block diagram of a video cropping device according to an embodiment of the present application.
Fig. 8 is a block diagram of an electronic device for implementing a video cropping method according to an embodiment of the present application.
Detailed Description
In the following, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments may be modified in various different ways, all without departing from the spirit or scope of the present application. Accordingly, the drawings and description are to be regarded as illustrative in nature, and not as restrictive.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
The following provides an explanation of the nomenclature to which this application relates:
video template: a template for editing a video has transformation effects of rotating, zooming, displacing and the like on a target video so as to achieve the attribute effect of the video template.
Cutting areas: and the area is used for cutting the video picture of the target video, in the video picture, the picture in the cutting area is reserved, and the picture outside the cutting area is cut.
And (3) cutting a picture: and if the to-be-cut picture covers the cutting area, the cut video obtained by cutting does not have black edges.
In order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the following description is provided for the related technologies:
when the video template is adopted to cut the video picture, the situation of the black edge often appears, namely after the video picture is transformed through rotation, scaling, displacement and the like, the situation that the video picture does not appear in the area of the video template appears, the black edge appears through cutting, the video creation effect is influenced, and the use experience of a user is reduced.
In view of the above, the embodiments of the present application provide a new video cropping scheme, which can be used to solve the above problem. In the video clipping scheme, in order to prevent the clipped video from generating black edges, it is necessary to ensure that the video frame covers the clipping area; the parameter threshold values of the video pictures during rotation, scaling, displacement and other transformations are determined through the preset function, so that the transformation within the parameter threshold values can ensure that the cutting area is within the video pictures, and the black edge condition cannot occur. For example: after the video picture rotates for a certain angle, the minimum zooming parameter value of the video picture can be determined through the trigonometric function relation, so that the video picture is changed according to the minimum zooming parameter value, and the cutting area is in the video picture. At this time, the video picture can be enlarged, and after the enlargement, the cutting area is in the video picture and has a gap with the video picture. The maximum displacement parameter value and the minimum zooming parameter value which can be transformed by the video picture can be determined through the distance from the central point of the clipping area to the high edge or the wide edge of the video picture, and the video picture is kept to be transformed within the large displacement parameter value or the minimum zooming parameter value, so that the clipping area is kept in the video picture.
An exemplary application environment diagram of the present application is provided below, as shown in fig. 1, which provides a system architecture 100 that may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 101, 102, 103 to interact with a server 105 over a network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen 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, motion Picture Experts compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, motion Picture Experts compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the video cropping method provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, the video cropping device is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 is a flowchart illustrating a video cropping method according to an embodiment of the present application. As shown in fig. 2, the video cropping method may include:
in step S210, a first parameter value of a video picture of a transform target video is received.
In this embodiment, the first parameter value may be any one of a displacement parameter, a rotation parameter, and a scaling parameter. The first parameter value is used for indicating the transformation of the video picture of the target video so as to meet the personalized requirement of the user. For example, the first parameter value is a 30 ° rotation, meaning that the video picture of the target video will be rotated 30 ° clockwise around the center point of the video picture. If the rotation angle value is negative, counterclockwise rotation is indicated. For another example, if the first parameter value is 1.5 times zoom, it means that the video screen of the target video is enlarged to 1.5 times the video screen. If the zooming multiple is more than 1, the video picture is enlarged; otherwise, if the zoom factor is smaller than 1, it means that the video frame is reduced.
In this embodiment of the application, the first parameter value may be a first parameter value formed by a user performing a dragging operation on a video screen of the target video on the terminal device 101, 102, or 103, or may be a first parameter value formed by a parameter value configured by the user on a parameter configuration interface of the terminal device 101, 102, or 103.
In the embodiment of the application, the first parameter value may be a parameter value of a video picture of the target video which is changed by a user for the first operation; or the parameter value used by the Nth user to transform the video picture, wherein N is a positive integer.
In the embodiment of the application, the target video can be obtained by uploading by a user, can be stored in a video cropping system, and can also be obtained by establishing a link with other platforms.
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 °; the threshold value of the displacement parameter can be set as the size of a cutting area, and the size of the cutting area is W in width and H in height; then the threshold values of the displacement parameters can be set to be displacement in the width direction of-W to W and displacement in the height direction of-H1 to H; the threshold value of the scaling parameter may be set to be-5 to 5 times.
By setting the corresponding threshold value for the first parameter value, the problem that the picture effect of the target video is influenced by excessively transforming the target video when a user performs transformation operation can be avoided. Or excessive conversion caused by hand error of the user.
Step S220, determining a cutting area.
In the embodiment of the application, the cutting area may be a default cutting area, or may be a cutting area selected according to the personalized requirements of the user. The default cropping area may be a fixed-scale and fixed-size cropping area, or may be an area determined from the received target video to be the same size, scale, and position as the received target video. The default clipping area can be set according to specific application conditions.
In one example, a default crop area may be determined according to a user's configured options.
In one example, the cropped area may be generated based on a user selected area of a particular size and scale or a user selected template. For example, the user selected template is 6:9, the picture size; and displaying a cutting area corresponding to the size of the picture in an interface display area based on the template.
In one example, the cropping zone may be determined based on the selected video template.
In the embodiment of the application, the cropping area is used for determining the picture area of the cropped video obtained after the target video is cropped. That is, the video frames falling within the cropping zone will generate the cropped video that will be visible when the cropped video is played.
Step S230, determining a picture to be cropped based on the video picture and the cropping area after the first parameter value transformation; the picture to be cut covers the cutting area.
The terminal devices 101, 102, 103 may have an interface display area thereon for displaying a video frame or a cropping area of the target video.
In the embodiment of the application, under the condition that the first parameter value is received, the video picture of the target video is changed along with the first parameter value, and meanwhile, the picture to be cut is determined in real time based on the cutting area, so that the picture to be cut can cover the cutting area during cutting.
In one example, after the target video is transformed based on the first parameter value, the interface display area does not display the video picture of the target video transformed based on the first parameter value, but displays the picture to be cropped determined based on the video picture transformed based on the first parameter value and the cropping area. The video pictures seen by the user can cover the cutting area, the picture effect is more attractive and visual, and the illusion that the user appears black edges after cutting the video can be avoided.
By displaying the picture to be cut and the cutting area in the interface display area, a user can conveniently preview whether the content of the video picture cut in the cutting area meets the expected requirement.
And step S240, cutting the picture to be cut based on the cutting area to obtain a cut video.
In the embodiment of the application, the picture to be cut is cut based on the cutting area, and the cutting can be performed after the information for confirming the cutting is received, so that the cut video after cutting is ensured to be the video required by a user.
In an exemplary application scenario, after the user performs the transformation of the first parameter value, the obtained video to be cropped does not have a black edge after the video to be cropped is cropped, but the user may want to adjust the video to be cropped again on the basis of the video to be cropped until the cropping is confirmed when the picture cropped according to the cropping area of the picture to be cropped displayed in the interface display area is a satisfactory picture.
In one example, after receiving the information confirming the cropping, the cropping video preview can be automatically played to facilitate the user to browse whether the video frames of the cropping video are all ideal video frames. And when the information for generating the cut video is received, the cut video is generated, so that the cut video is convenient for a user to store.
According to the method and the device, after the video picture of the target video is transformed based on the first parameter value, the picture to be cut is determined according to the cutting area and the transformed video picture, and the picture to be cut covers the cutting area, so that the picture to be cut is cut in the cutting area, and the obtained cut video does not have black edges.
In one embodiment, step S220 includes: determining a cutting area based on the original size of the target video; alternatively, an edit size is received, and a crop area is determined based on the edit size.
In one example, the original picture size of the target video is W wide and H high; determining the size of the cutting area to be W in width and H in height; and meanwhile, the position of the cutting area is the same as that of the target video.
In one example, the edit size may be a preset regular scale size selected by the user, representing a particular size of video frame, such as 4:9 picture size; or the high and wide parameter information of the cropping area input by the user.
In one example, the user selects a video module, which is sized to the cropping area based on the screen size specified in the video template.
Generally, after obtaining the size of the cropping area, in the interface display area, the central point of the cropping area is overlapped with the central point of the target video, so as to crop the target video conveniently.
In one embodiment, as shown in fig. 3, step S230 includes:
in step S231, boundary information of the video frame after the first parameter value transformation is acquired.
Step S232, determining whether the video frame after the first parameter value transformation covers the cropping area based on the boundary information.
Step 233, obtaining a minimum zoom parameter value under the condition that the video frame after the first parameter value transformation does not cover the cutting area;
in step S234, the video frame transformed by the first parameter value and the minimum scaling parameter value is determined as the frame to be cut.
In one example, in the case that the original screen size of the target video is W and H, the size of the cropping area is the same as the original screen size, and the first parameter value is a rotation of a °, it may be determined that the cropping area is not covered by the video screen after the first parameter value transformation, according to the boundary information of the video screen after the first parameter value transformation.
The boundary information of the video picture after the first parameter value transformation may be coordinate information of four vertices of the video picture.
In one example, when the clipping region 120 is obtained, a central point of the clipping region 120 coincides with an original central position of the target video, and vertex coordinates of video pictures of the clipping region 120 and the target video are obtained with the central point as an origin; and calculating to obtain the vertex coordinates of the video picture after the first parameter value is transformed according to the information of the first parameter value. Thereby obtaining the boundary information of the video picture after the first parameter value transformation according to the vertex coordinate information.
Based on the vertex coordinate information of the clipping region and the vertex coordinate information of the video picture after the first parameter value transformation, it may be determined whether the video picture after the first parameter value transformation covers the clipping region.
And after the video picture of the target video is subjected to transformation rotating by A degrees, the cropping area is not covered. The video frame after the first parameter value transformation (rotation by a °) needs to be enlarged again to ensure that the video frame of the target video covers the cropping area 120.
As shown in fig. 4 and 5, when the original screen size of the target video is W and H, the size of the cropping area is the same as the original screen size, and the first parameter value is a rotation of a °, the interface display area 200 displays the to-be-cropped screen 110 and the cropping area 120.target W is the target width which can cover the cutting area 120 after the video picture after the first parameter value is transformed is zoomed by a certain multiple; target H is the target height that the video frame after the first parameter value transformation can cover the clipping region 120 after being scaled by a certain multiple. Then:
target W=W×cos A+H×sin A
target H=H×cos A+W×sin A
to achieve the target width, the minimum multiple of scaling is required to beTo achieve the target height, the minimum multiple of scaling is required to beTherefore, in order to achieve the target width and the target height simultaneously, so that the enlarged video image can cover the cropping area 120, the minimum zoom parameter value required to be zoomed is determined as
Determining the video frame transformed by the first parameter value and the minimum scaling parameter value as the frame to be cropped 110 can ensure that the frame to be cropped 110 covers the cropping area 120.
In one embodiment, as shown in fig. 3, step S230 includes:
in step S231, boundary information of the video frame after the first parameter value transformation is acquired.
In step S232, it is determined whether the video frame after the first parameter value transformation covers the cropping area based on the boundary information.
In step S235, when it is determined that the video frame after the first parameter value transformation covers the clipping area, it is determined that the video frame after the first parameter value transformation is the frame to be clipped.
In one example, as shown in fig. 6, the original screen size of the target video is W in width and H in height, the size of the cropping area is the same as the original screen size, the user rotates the video screen of the target video by a ° and then zooms the video screen 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 image of the target video by A degrees, the video image can be zoomed based on the clipping area covered by the image to be clippedDoubling, i.e. the width of the video picture after transformation by rotation aThe height of the video picture isAnd at the moment, zooming by B times, wherein B is larger than 1, continuously zooming, and determining that the zoomed video picture can cover the clipping area and the boundary of the clipping area and the video picture has a certain distance. The video frame transformed by the first parameter value is determined as the frame to be cropped 110, so that the frame to be cropped can cover the cropping area. In this case, the cropping zone 120 processes the video picture after the first parameter value is transformedWhen the line is cut, no black edge appears, and the user can continue to shift or zoom the video picture within the boundary range.
In one embodiment, in step S235, when it is determined that the video picture after the first parameter value transformation covers the cropping area, the method further includes:
determining a first parameter threshold value of a transformed video picture based on the video picture and the cutting area after the first parameter value is transformed;
receiving a second parameter value of the transformed video picture;
and under the condition that the second parameter value exceeds the first parameter threshold value, determining that the video picture is converted by the first parameter threshold value as the video picture after the second parameter value is converted.
In the above example, as shown in fig. 6, the original screen size of the target video is W in width and H in height, the size of the cropping area is the same as the original screen size, the first parameter value is a rotation of a °, and a magnification of B times, and the screen 110 to be cropped based on the magnification of B times is acquired. However, the user may also want to adjust the video frame on the basis of this, for example, also want to perform a shift, zoom or rotate operation on the video frame, and then input the second parameter value.
In order to ensure that the video picture transformed based on the second parameter value covers the cropping area, the maximum displacement value for performing the displacement operation on the video picture can be: the distance (t 1 or t 2) from the center point P of the clipping region 120 to the wide side of the video frame is greater than or equal toAnd the distance (t 3 or t 4) from the center point P of the cutting area 12 to the high edge of the video picture is more than or equal toI.e. it can also be moved a maximum distance in the broadside directionOr moved by the maximum distance toward the high sideWherein, the distance is positive, which indicates moving to the right or upward; the distance is negative indicating a movement to the left or downwards.
In the embodiment of the present application, the distance (t 1 or t 2) from the center point P of the cropping area 120 to the wide side or the distance (t 3 or t 4) from the high side of the video frame may be obtained by a distance calculation formula from a point to a straight line.
In the embodiment of the present application, as shown in fig. 6, the distance (t 1 or t 2) from the center point P of the cropping area 120 to the video frame wide side of the transformed target video is the distance from the center point P of the cropping area 120 to the two width sides of the video frame 110; the distance (t 3 or t 4) from the center point P of the cropping area 120 to the video frame height edge of the transformed target video is the distance from the center point P of the cropping area 120 to the two height edges of the video frame.
In the above example, after the user rotates the target video by a ° and zooms in by B times, the minimum zoom parameter value that can also be zoomed in is zoom out by 1/B times. Namely, the scaled threshold parameter is equal to or greater than 1/B.
And under the condition that the second parameter value does not exceed the first parameter threshold value, determining that the video picture transformed by the second parameter value is used as the video picture after the second parameter value is transformed. That is, the video frame of the target video with the transformed second parameter value still meets the requirement of covering the clipping area, and the video frame of the target video with the transformed second parameter value can be determined as the frame to be clipped.
And under the condition that the second parameter value exceeds the first parameter threshold value, determining that the video picture transformed by the first parameter threshold value is used as the video picture transformed by the second parameter value. Exemplarily, if the second parameter value is 1/(B + 1) times reduction, only 1/B times reduction is performed, and the video picture reduced by 1/B times is shown as the picture to be cropped.
According to the embodiment of the application, the second parameter value for converting the video picture is limited through the first parameter threshold, so that the video picture after the second parameter value is converted is ensured to cover the cutting area.
In one embodiment, the method further comprises:
determining to transform the video picture with the second parameter value if the second parameter value does not exceed the first parameter threshold;
and determining a second parameter threshold value of the transformed video picture based on the video picture after the cropping area and the second parameter value transformation.
Illustratively, the original picture size of the target video is W wide and H high, the size of the cropping area is the same as the original picture size, and the user rotates the target video a °, zooms in B times, and moves S to the right, the range of S being: after the video picture has moved to the right by S, the scalable minimum scaling parameter value and the displaceable maximum displacement distance need to be re-determined. So that the video picture moves in the range of the second parameter threshold value, and the video picture can be ensured to cover the cutting area.
In the embodiment of the application, the user may perform the rotation operation after rotating the target video by a ° and magnifying by B times, or after rotating the target video by a °, magnifying by B times, and moving the target video to the right by S.
In one example, the parameter threshold for rotation is set to 0 ° to 45 °; the user can operate the video picture to rotate by any angle from 0 degrees to 45 degrees, and the rotation angle is not limited according to the boundary information of the video picture. When the video picture rotates a certain angle and the video picture does not cover the cutting area, the video picture is adaptively amplified by obtaining the minimum zooming parameter value so as to ensure that the video picture covers the cutting area.
In the embodiment of the application, the video frame rotates based on a certain angle and the video center.
The first parameter value and the second parameter value in the embodiment of the present application are not limited to the variable parameters of the displacement parameter, the scaling parameter, and the rotation parameter; variable parameters for transforming video pictures that may be used in the future may also be included.
In one embodiment, step S230 is preceded by:
receiving a self-adaptive request, wherein the self-adaptive request is used for determining whether a picture to be cut needs to be determined based on the video picture and the cutting area after the first parameter value is converted;
and under the condition that the self-adaption request is determined to be negative, the video picture after the first parameter value transformation is cut based on the cutting area, and a cut video is obtained.
The method and the device for determining the cropping video confirm whether the user needs to meet the condition that the cropping video does not include the black border or not by receiving the self-adaptive request. And if the self-adaptive request is determined to be negative, the video picture after the first parameter value transformation is cut based on the cutting area to obtain a cut video, and black edges may appear in the cut video. If the adaptive request is determined to be yes, after the first parameter value is received, determining a picture to be cropped based on the video picture after the first parameter value is converted and the cropping area, so as to crop the video picture after the first parameter value is converted based on the cropping area to obtain a cropped video, and ensuring that no black edge occurs in the cropped video.
In the embodiment of the application, whether the target video needs to be adaptively transformed or not can be selected in a configuration mode.
Fig. 7 is a block diagram illustrating a video cropping device 800 according to an embodiment of the present application. As shown in fig. 7, the video cropping device 800 may include:
a first parameter value receiving module 810, configured to receive a first parameter value of a video frame of a transform target video;
a cropping zone determining module 820 for determining a cropping zone;
a to-be-cropped picture determining module 830 for determining a to-be-cropped picture based on the video picture and the cropping area after the first parameter value is transformed; covering a cutting area with a picture to be cut;
and the cutting module 840 is used for cutting the picture to be cut based on the cutting area to obtain a cut video.
In one embodiment, the cropping zone determination module 820 is configured to:
determining a cutting area based on the original picture size of the target video; alternatively, the first and second electrodes may be,
receiving an edit size, and determining a cropping area based on the edit size.
In one embodiment, the to-be-cropped picture determination module 830 includes:
the boundary information acquisition module is used for acquiring the boundary information of the video picture after the first parameter value is transformed; determining whether the video picture after the first parameter value transformation covers the cutting area or not based on the boundary information;
the minimum zooming parameter value obtaining module is used for obtaining a minimum zooming parameter value under the condition that the video picture after the first parameter value transformation does not cover the clipping area;
the to-be-cropped picture determining module 830 is configured to determine the video picture transformed by the first parameter value and the minimum scaling parameter value as the to-be-cropped picture.
In one embodiment, the to-be-cropped picture determination module 830 includes:
the boundary information acquisition module is used for acquiring the boundary information of the video picture after the first parameter value is transformed; determining whether the video picture after the first parameter value transformation covers the cutting area or not based on the boundary information;
the to-be-cropped picture determining module 830 is configured to determine that the video picture with the transformed first parameter value is the to-be-cropped picture when it is determined that the video picture with the transformed first parameter value covers the cropping area.
In one embodiment, the video cropping device 800 further comprises:
the first parameter threshold value determining module is used for determining a first parameter threshold value of a converted video picture based on the video picture and the cutting area after the first parameter value is converted;
the second parameter value receiving module is used for receiving a second parameter value of the converted video picture;
and the video transformation module is used for determining that the video picture is transformed by the first parameter threshold value under the condition that the second parameter value exceeds the first parameter threshold value.
In one embodiment, the video cropping device 800 further comprises: and the second parameter threshold value determining module is used for determining a second parameter threshold value of the converted video picture based on the clipping area and the video picture after the second parameter value conversion.
In one embodiment, the video cropping device 800 further comprises:
the adaptive request receiving module is used for receiving an adaptive request, and the adaptive request is used for determining whether a picture to be cut needs to be determined based on the video picture and the cutting area after the first parameter value is converted;
the cropping module 840 is configured to crop the video frame after the first parameter value is transformed based on the cropping area to obtain a cropped video if the adaptive request is determined as no.
The functions of the modules in the apparatuses in the embodiment of the present application may refer to the corresponding descriptions in the above methods, and are not described herein again.
Fig. 8 shows a block diagram of an electronic device according to an embodiment of the present application. As shown in fig. 8, the electronic apparatus includes: a memory 910 and a processor 920, the memory 910 having stored therein instructions operable on the processor 920. Processor 920, when executing the instructions, implements the video cropping method in the embodiments described above. The number of the memory 910 and the processor 920 may be one or more. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may 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 meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
The electronic device may further include a communication interface 930 for communicating with an external device for data interactive transmission. The various devices are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor 920 may process instructions for execution within the electronic device, including instructions stored in or on a memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to an interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, if desired. Also, multiple electronic devices may be connected, with each device providing some of the necessary operations (e.g., as an array of servers, 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, etc. For ease of illustration, only one thick line is shown in FIG. 8, but this is not intended to represent only one bus or type of bus.
Optionally, in an 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 may complete communication with each other through an internal interface.
It should be understood that the processor may be a Central Processing Unit (CPU), other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or any conventional processor or the like. It is noted that the processor may be a processor supporting advanced reduced instruction set machine (ARM) architecture.
Embodiments of the present application provide a computer-readable storage medium (such as the above-mentioned memory 910) storing computer instructions, which when executed by a processor implement the methods provided in embodiments of the present application.
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 program required for at least one function; the storage data area may store data created according to use of the electronic device cropped from the video, and the like. Further, the memory 910 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 910 optionally includes memory located remotely from processor 920, which may be connected to a video cropping electronic device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more (two or more) executable instructions for implementing specific logical functions or steps in the process. And the scope of the preferred embodiments of the present application includes other implementations in which functions may be performed out of the order shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. All or part of the steps of the method of the above embodiments may be implemented by hardware that is configured to be instructed to perform the relevant steps by a program, which may be stored in a computer-readable storage medium, and which, when executed, includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module may also be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. The storage medium may be a read-only memory, a magnetic or optical disk, or the like.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various changes or substitutions within the technical scope of the present application, and these should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. A method of video cropping, comprising:
receiving a first parameter value of a video picture of a transformation target video;
determining a cutting area;
determining a picture to be cut based on the video picture after the first parameter value is transformed and the cutting area; the picture to be cut covers the cutting area;
and cutting the picture to be cut based on the cutting area to obtain a cut video.
2. The method of claim 1, wherein the determining a clipping region comprises:
determining a cutting area based on the original picture size of the target video; alternatively, the first and second electrodes may be,
receiving an edit size, and determining a cutting area based on the edit size.
3. The method according to claim 1, wherein determining a picture to be cropped based on the video picture transformed by the first parameter value and the cropping area comprises:
acquiring boundary information of the video picture after the first parameter value is transformed; determining whether the video picture after the first parameter value transformation covers the cutting area or not based on the boundary information;
obtaining a minimum zooming parameter value under the condition that the video picture after the first parameter value transformation does not cover the cutting area;
and determining a video picture which is jointly transformed by the first parameter value and the minimum scaling parameter value as the picture to be cut.
4. The method according to claim 1, wherein determining a picture to be cropped based on the video picture transformed by the first parameter value and the cropping area comprises:
acquiring boundary information of the video picture after the first parameter value is transformed; determining whether the video picture after the first parameter value transformation covers the cutting area or not based on the boundary information;
and under the condition that the video picture after the first parameter value transformation covers the cutting area, determining that the video picture after the first parameter value transformation is the picture to be cut.
5. The method of claim 4, further comprising:
determining a first parameter threshold value of a transformed video picture based on the video picture after the first parameter value transformation and the cutting area;
receiving a second parameter value of the transformed video picture;
and under the condition that the second parameter value exceeds the first parameter threshold value, determining that the video picture transformed by the first parameter threshold value is used as the video picture transformed by the second parameter value.
6. The method of claim 5, further comprising:
determining to transform a video picture with the second parameter value if the second parameter value does not exceed the first parameter threshold;
and determining a second parameter threshold value of the converted video picture based on the clipping area and the video picture after the second parameter value conversion.
7. The method according to any one of claims 1 to 6, wherein the determining a picture to be cropped based on the video picture transformed by the first parameter value and the cropping area further comprises:
receiving an adaptive request, wherein the adaptive request is used for determining whether a picture to be cut needs to be determined based on the video picture after the first parameter value is transformed and the cutting area;
and under the condition that the self-adaptive request is determined to be negative, the video picture after the first parameter value transformation is cut based on the cutting area, so that a cut video is obtained.
8. A video cropping device, comprising:
the first parameter value receiving module is used for receiving a first parameter value of a video picture of a transformation target video;
the cutting area determining module is used for determining a cutting area;
a to-be-cut picture determining module, configured to determine a to-be-cut picture based on the video picture after the first parameter value transformation and the cutting area; the picture to be cut covers the cutting area;
and the cutting module is used for cutting the picture to be cut based on the cutting area to obtain a cut video.
9. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A computer readable storage medium having stored therein computer instructions which, when executed by a processor, implement the method of any one of claims 1-7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211323918.0A CN115665347A (en) | 2022-10-27 | 2022-10-27 | Video clipping method and device, electronic equipment and storage medium |
PCT/CN2023/099454 WO2024087643A1 (en) | 2022-10-27 | 2023-06-09 | Video cropping method and apparatus, electronic device, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211323918.0A CN115665347A (en) | 2022-10-27 | 2022-10-27 | Video clipping method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115665347A true CN115665347A (en) | 2023-01-31 |
Family
ID=84994122
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211323918.0A Pending CN115665347A (en) | 2022-10-27 | 2022-10-27 | Video clipping method and device, electronic equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115665347A (en) |
WO (1) | WO2024087643A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024087643A1 (en) * | 2022-10-27 | 2024-05-02 | 上海幻电信息科技有限公司 | Video cropping method and apparatus, electronic device, and storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4013138B2 (en) * | 2002-12-13 | 2007-11-28 | 富士フイルム株式会社 | Trimming processing apparatus and trimming processing program |
US9933935B2 (en) * | 2011-08-26 | 2018-04-03 | Apple Inc. | Device, method, and graphical user interface for editing videos |
US8810666B2 (en) * | 2012-01-16 | 2014-08-19 | Google Inc. | Methods and systems for processing a video for stabilization using dynamic crop |
JP2022069931A (en) * | 2020-10-26 | 2022-05-12 | 株式会社Jvis | Automated trimming program, automated trimming apparatus, and automated trimming method |
CN114612485A (en) * | 2022-03-10 | 2022-06-10 | 北京达佳互联信息技术有限公司 | Image clipping method and device and storage medium |
CN115665347A (en) * | 2022-10-27 | 2023-01-31 | 上海幻电信息科技有限公司 | Video clipping method and device, electronic equipment and storage medium |
-
2022
- 2022-10-27 CN CN202211323918.0A patent/CN115665347A/en active Pending
-
2023
- 2023-06-09 WO PCT/CN2023/099454 patent/WO2024087643A1/en unknown
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024087643A1 (en) * | 2022-10-27 | 2024-05-02 | 上海幻电信息科技有限公司 | Video cropping method and apparatus, electronic device, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
WO2024087643A1 (en) | 2024-05-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11282182B2 (en) | Image processing method and apparatus, computer-readable medium, and electronic device | |
CN107204023B (en) | Method and apparatus for avoiding distortion of graphics drawn in canvas | |
CN109947972A (en) | Reduced graph generating method and device, electronic equipment, storage medium | |
US8532435B1 (en) | System and method for automatically adapting images | |
WO2016066147A2 (en) | Method and device for processing image | |
CN110221722B (en) | Picture processing method, electronic device and storage medium | |
US20100164986A1 (en) | Dynamic Collage for Visualizing Large Photograph Collections | |
CN111045620B (en) | Multi-signal-source scene on-screen display method and multi-signal-source scene on-screen display system | |
JP4742051B2 (en) | Spatial and temporal motion blur effect generation method | |
US10783685B2 (en) | Banner image generation | |
WO2019237743A1 (en) | Image processing method, device, electronic device and computer readable storage medium | |
US20140267115A1 (en) | Method for controlling display function and an electronic device thereof | |
CN103702032A (en) | Image processing method, device and terminal equipment | |
CN115665347A (en) | Video clipping method and device, electronic equipment and storage medium | |
CN112965650A (en) | Thermodynamic diagram visualization method and system and computer equipment | |
CN109325902B (en) | Panoramic image fusion method, device and system and computer readable storage medium | |
CN112927163A (en) | Image data enhancement method and device, electronic equipment and storage medium | |
CN110223220B (en) | Method and device for processing image | |
CN111726666A (en) | Video display control method and device | |
CN111448534B (en) | Terminal device, graphical user interface thereof and control method of graphical user interface | |
CN116107531A (en) | Interface display method and device | |
US20220308740A1 (en) | Information processing system and non-transitory computer readable medium storing program | |
Zhang et al. | Image retargeting with multifocus fisheye transformation | |
CN109085974B (en) | Screen control method, system and terminal equipment | |
US20210065333A1 (en) | Image processing apparatus and non-transitory computer readable medium storing program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |