Video processing method and electronic device

By receiving and processing the movement of the video cropping interface in an electronic device, adjusting the video screen using the zoom and rebound distances, making the cropping box completely located in the video screen, solving the problem of the external area of ​​the cropping box and improving the video cropping effect.

CN117692582BActive Publication Date: 2025-01-14HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311400931.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-05-30
Filing Date
2022-08-15
Publication Date
2025-01-14
Estimated Expiration
2042-08-15

AI Technical Summary

Technical Problem

When cropping videos with electronic devices, rotation, scaling and dragging operations of the cropping box may cause some areas of the cropping box to be located outside the video screen, resulting in poorer clipping video effects.

Method used

By receiving the moving operation in the video cropping interface, it is determined whether the cropping frame is all located in the video screen. If there is an area outside, it is determined according to the first critical scaling ratio of the rotation operation, the second critical scaling ratio of the scaling operation, and the return of the drag operation Adjust the video screen by popping distance so that the cropping frames are all located in the video screen.

Benefits of technology

Ensure that the cropped video does not contain non-video areas other than the video screen, which improves the video cropping effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117692582B_ABST
    Figure CN117692582B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a video processing method and an electronic device, which are applied in the field of electronic technology. When performing mobile operations such as rotating, scaling, and dragging on the video screen displayed in the video cropping interface, the method will determine whether the cropping frame is entirely within the video screen. If there is an area outside the video screen in the cropping frame, the video screen can be adjusted according to the adjustment parameters corresponding to the mobile operation, so that the cropping frame is entirely within the adjusted video screen. Therefore, when the embodiments of the present application use the cropping frame to crop the video screen that has been rotated, scaled, and dragged, the video screen can be adjusted by adjusting the parameters, so that the cropping frame is entirely within the adjusted video screen, that is, the cropping frame no longer includes non-video screens, so that non-video screens outside the video screen will not appear in the cropped video, thereby improving the effect of the cropped video.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with application number 202210975830.0 filed on August 15, 2022 and invention name “Video processing method and electronic device”. Technical Field

[0002] The present application relates to the field of electronic technology, and in particular to a video processing method and electronic equipment. Background Art

[0003] With the continuous development of electronic technology, electronic devices such as smart phones and tablet computers have been widely used in people's lives and work. When users use electronic devices, they can use the electronic devices to shoot videos, and they can use cropping frames to crop the captured video images to obtain cropped videos.

[0004] However, when a cropping frame is used to crop a video screen that has been rotated, scaled, dragged, etc., part of the cropping frame may be outside the video screen, that is, the cropping frame includes part of the non-video screen, resulting in poor video quality after cropping. Summary of the invention

[0005] The embodiments of the present application provide a video processing method and an electronic device, which adjust the video screen when the video screen is rotated, scaled, and dragged, so that the cropping frame is completely located within the adjusted video screen, thereby improving the effect of the cropped video.

[0006] In a first aspect, an embodiment of the present application proposes a video processing method, which includes: an electronic device receives a moving operation on a video screen displayed in a video cropping interface, the moving operation including at least one of a rotation operation, a zoom operation and a drag operation; the electronic device determines, in response to the moving operation, whether the cropping frame in the video cropping interface is entirely located within the video screen; when there is an area outside the video screen in the cropping frame, the electronic device adjusts the video screen according to adjustment parameters corresponding to the moving operation, so that the cropping frame is entirely located within the adjusted video screen; wherein the adjustment parameters corresponding to the rotation operation include a first critical zoom ratio, the adjustment parameters corresponding to the zoom operation include a second critical zoom ratio, and the adjustment parameters corresponding to the drag operation include a rebound distance.

[0007] In this way, when the cropping frame is used to crop the video screen that has been rotated, scaled, dragged, etc., the video screen can be adjusted by adjusting the parameters so that the cropping frame is completely located within the adjusted video screen, that is, the cropping frame no longer includes non-video screens, so that non-video screens other than the video screen will not appear in the cropped video, thereby improving the effect of the cropped video.

[0008] In a possible implementation, an electronic device receives a moving operation on a video screen displayed in a video cropping interface, including: the electronic device receives a touch operation on a first rotation control in the video cropping interface; the first rotation control is used to rotate the video screen according to the angle scale value corresponding to the touch operation when triggered. The electronic device responds to the moving operation and determines whether the cropping frame in the video cropping interface is completely located in the video screen, including: the electronic device responds to the touch operation and obtains the first vertex coordinates of each vertex in the video screen during the rotation process and the second vertex coordinates of each vertex in the cropping frame; the electronic device calculates the first critical scaling ratio of the video screen according to the first vertex coordinates and the second vertex coordinates; the electronic device determines whether the cropping frame is completely located in the video screen during the rotation process according to the first critical scaling ratio and the first scaling ratio of the video screen during the rotation process relative to the original video screen. When there is an area outside the video screen in the cropping frame, the electronic device adjusts the video screen according to the adjustment parameter corresponding to the moving operation, including: when there is an area outside the video screen in the cropping frame, the electronic device zooms in on the video screen during the rotation process according to the first critical scaling ratio. In this way, when the video picture is rotated, the video picture in the rotating process is enlarged based on the first critical zoom ratio, so that the cropping frame is completely located in the enlarged video picture.

[0009] In one possible implementation, the electronic device determines whether the cropping frame is entirely within the video picture during the rotation process based on a first critical scaling ratio and a first scaling ratio of the video picture during the rotation process relative to the original video picture, including: when the first critical scaling ratio is greater than the first scaling ratio, the electronic device determines that there is an area in the cropping frame that is outside the video picture during the rotation process; when the first critical scaling ratio is less than or equal to the first scaling ratio, the electronic device determines that the cropping frame is entirely within the video picture during the rotation process.

[0010] In a possible implementation, the electronic device calculates a first critical zoom ratio of a video screen according to first vertex coordinates and second vertex coordinates, including: the electronic device calculates a first line formed between every two adjacent vertices in the video screen according to the first vertex coordinates of each vertex in the video screen; the electronic device calculates a second line formed between a center point of the cropping frame and each vertex in the cropping frame according to the second vertex coordinates of each vertex in the cropping frame; the electronic device calculates an intersection formed between a first line corresponding to a first target vertex and a corresponding second line to obtain a target intersection corresponding to the first target vertex, the first target vertex is any vertex in the cropping frame, the first line corresponding to the first target vertex is a first line in the video screen that is closest to the first target vertex, and the second line corresponding to the first target vertex is a second line formed between the first target vertex and the center point of the cropping frame; the electronic device calculates a first spacing between the first target vertex and the center point of the cropping frame, and a second spacing between the target intersection and the center point of the cropping frame; the electronic device calculates the first critical zoom ratio of the video screen according to the first spacing and the second spacing. In this way, the first critical scaling ratio can be conveniently calculated based on the first vertex coordinates of each vertex in the video screen and the second vertex coordinates of each vertex in the cropping frame, and the calculation method is relatively simple.

[0011] In a possible implementation, the electronic device calculates the first critical zoom ratio of the video screen according to the first spacing and the second spacing, including: the electronic device determines the ratio of the first spacing to the second spacing as the target ratio value corresponding to the first target vertex; the electronic device determines the maximum value of the target ratio values ​​corresponding to each vertex in the cropping frame as the first critical zoom ratio of the video screen. In this way, the maximum value of the target ratio values ​​corresponding to the four vertices is used as the first critical zoom ratio, which can ensure that the cropping frame is completely located in the video screen after being enlarged by the first critical zoom ratio.

[0012] In a possible implementation, the electronic device responds to a moving operation to determine whether the cropping frame in the video cropping interface is completely located within the video screen; the electronic device responds to a dragging operation to obtain the third vertex coordinates of each vertex in the dragged video screen and the fourth vertex coordinates of each vertex in the cropping frame; the electronic device determines whether the cropping frame is completely located within the dragged video screen based on the third vertex coordinates and the fourth vertex coordinates. When there is an area outside the video screen in the cropping frame, the electronic device adjusts the video screen according to the adjustment parameters corresponding to the moving operation, including: when there is an area outside the dragged video screen in the cropping frame, the electronic device rebounds the dragged video screen according to the rebound distance. In this way, after the video screen is dragged, the video screen after the dragging is rebounded based on the rebound distance, so that the cropping frame is completely located within the rebounded video screen.

[0013] In one possible implementation, the electronic device determines whether the cropping frame is entirely within the dragged video screen based on the third vertex coordinates and the fourth vertex coordinates, including: when the rotation angle of the video screen is not 0° and is not an integer multiple of 90°, the electronic device calculates the third line formed between every two adjacent vertices in the video screen based on the third vertex coordinates of each vertex in the video screen; the electronic device calculates the coordinates of the vertical points from each vertex in the cropping frame to the corresponding third lines; the electronic device determines whether the cropping frame is entirely within the dragged video screen based on the vertical point coordinates and the fourth vertex coordinates.

[0014] In a possible implementation, before the electronic device rebounds the dragged video screen according to the rebound distance, it also includes: when the rotation angle of the video screen is not 0° and is not an integer multiple of 90°, the electronic device determines the second target vertex that is closest to the center point of the cropping frame among the vertices in the dragged video screen; the electronic device obtains the critical coordinates of the critical point corresponding to the second target vertex, and the critical point is consistent with the orientation of the second target vertex; the electronic device determines whether the number of vertices in the cropping frame that are outside the dragged video screen is greater than 1 based on the third vertex coordinates corresponding to the second target vertex, the critical coordinates corresponding to the critical point, the fourth vertex coordinates corresponding to the third target vertex, and the vertical point coordinates corresponding to the two target vertical points, the third target vertex is the vertex in the cropping frame that is consistent with the orientation of the second target vertex, and the target vertical point is the two vertices corresponding to the second target vertex in the cropping frame, to the vertical points on the two boundary lines adjacent to the second target vertex in the video screen; when at least two vertices in the cropping frame are outside the dragged video screen, the electronic device uses the deviation distance between the critical point and the second target vertex as the rebound distance. In this way, the rebound distance is simply calculated based on the second target vertex that is closest to the critical point and the center point of the cropping frame.

[0015] In a possible implementation, when a vertex in the cropping frame is outside the video screen after dragging, the electronic device obtains the fourth vertex coordinates corresponding to the fourth target vertex in the cropping frame outside the video screen; the electronic device uses the deviation distance between the fourth vertex coordinates corresponding to the fourth target vertex and the vertical point coordinates of the corresponding target vertical point as the rebound distance. In this way, when only one vertex in the cropping frame is outside the video screen after dragging, rebounding is performed based on the deviation distance between the fourth target vertex and the target vertical point, which can improve the rebound effect.

[0016] In a possible implementation, before the electronic device performs a rebound operation on the dragged video screen according to the rebound distance, it also includes: when the rotation angle of the video screen is 0° or an integer multiple of 90°, the electronic device determines the fifth target vertex that is closest to the center point of the cropping frame among each vertex in the dragged video screen; the electronic device calculates the rebound distance based on the fourth vertex coordinates corresponding to the vertex in the cropping frame that is consistent with the orientation of the fifth target vertex, and the third vertex coordinates corresponding to the fifth target vertex.

[0017] In a possible implementation, the electronic device determines whether the cropping frame in the video cropping interface is entirely within the video screen in response to a moving operation, including: the electronic device obtains a second scaling ratio of the scaled video screen relative to the original video screen in response to a zooming operation; the electronic device calculates a second critical scaling ratio of the video screen; the electronic device determines whether the cropping frame is entirely within the scaled video screen based on the second critical scaling ratio and the second scaling ratio. When there is an area outside the video screen in the cropping frame, the electronic device adjusts the video screen according to the adjustment parameters corresponding to the moving operation, including: when there is an area outside the scaled video screen in the cropping frame, the electronic device zooms in on the scaled video screen according to the second critical scaling ratio. In this way, after the video screen is zoomed, the zoomed video screen is zoomed in and rebounded based on the second critical scaling ratio, so that the cropping frame is entirely within the zoomed-in and rebounded video screen.

[0018] In one possible implementation, the electronic device determines whether the cropping frame is entirely within the scaled video picture based on the second critical zoom ratio and the second zoom ratio, including: when the second critical zoom ratio is greater than the second zoom ratio, the electronic device determines that there is an area in the cropping frame that is outside the scaled video picture; when the second critical zoom ratio is less than or equal to the second zoom ratio, the electronic device determines that the cropping frame is entirely within the scaled video picture.

[0019] In a possible implementation, the electronic device calculates the second critical zoom ratio of the video screen, including: when the rotation angle of the video screen is not 0° and is not an integer multiple of 90°, the electronic device calculates the critical distance of the video screen according to the width of the cropping frame, the height of the cropping frame, and the rotation angle of the video screen triggered by the first rotation control; the electronic device determines the ratio of the critical distance to the original size of the video screen as the second critical zoom ratio; the original size of the video screen is the original width of the video screen or the original height of the video screen. In this way, the second critical zoom ratio can be conveniently calculated based on the width of the cropping frame, the height of the cropping frame, and the rotation angle corresponding to the first rotation control, and the calculation method is relatively simple.

[0020] In a possible implementation, the electronic device calculates the second critical scaling ratio of the video screen, including: when the rotation angle of the video screen is 0° or an integer multiple of 90°, the electronic device uses the ratio of the target size of the cropping frame to the original size of the video screen as the second critical scaling ratio; wherein the target size of the cropping frame is the height of the cropping frame, and the original size of the video screen is the original height of the video screen; or, the target size of the cropping frame is the width of the cropping frame, and the original size of the video screen is the original width of the video screen. In this way, a method for calculating the second critical scaling ratio when the rotation angle corresponding to the first rotation control is 0° is provided.

[0021] In a possible implementation, the video processing method further includes: when the rotation angle of the video screen is not 0° and is not an integer multiple of 90°, the electronic device receives a drag operation on the cropping frame; the electronic device obtains the fifth vertex coordinates of each vertex in the video screen in response to the drag operation; the electronic device calculates the fourth line formed between each adjacent two vertices in the video screen based on the fifth vertex coordinates of each vertex in the video screen; the electronic device calculates the drag boundary of the cropping frame based on the intersection coordinates corresponding to the intersection formed between the extension lines of the four boundary lines in the cropping frame and the fourth line; the drag boundary is the boundary corresponding to the maximum range allowed for dragging of the cropping frame. In this way, the drag boundary of the cropping frame can be easily calculated.

[0022] In a possible implementation, the video processing method further includes: after the scaled video screen is dragged, the electronic device obtains the sixth vertex coordinates of each vertex of the dragged video screen and the actual scaling ratio of the video screen; the electronic device determines the first axis point of the video screen according to the sixth vertex coordinates and the center point of the cropping frame; the electronic device determines the second axis point corresponding to the video screen in the video screen after the actual scaling ratio is reduced according to the actual position of the first axis point in the dragged video screen, and the video screen is reduced with the original axis point as the scaling center point; the electronic device calculates the deviation between the sixth vertex coordinates and the actual vertex coordinates of the video screen after the actual scaling ratio is enlarged, and the video screen is enlarged with the second axis point as the scaling center point; the electronic device updates the coordinates of the video screen according to the deviation value. In this way, after the scaled video screen is dragged, the axis point of the video screen is updated, and when the video screen is rotated or scaled again in the subsequent operation, the part of the screen actually required by the user can be located in the cropping frame.

[0023] In a possible implementation, the electronic device determines the first axis point of the video screen according to the sixth vertex coordinates and the center point of the cropping frame, including: the electronic device calculates the fifth line and the sixth line of the dragged video screen according to the sixth vertex coordinates, the fifth line and the sixth line are two adjacent boundary lines in the dragged video screen; the electronic device calculates the first axis point distance from the center point of the cropping frame to the fifth line, and the second axis point distance from the center point of the cropping frame to the sixth line; the electronic device divides the first axis point distance by the actual width of the video screen, and then multiplies it by the original width of the video screen to obtain the horizontal coordinate of the first axis point; the electronic device divides the second axis point distance by the actual height of the video screen, and then multiplies it by the original height of the video screen to obtain the vertical coordinate of the first axis point.

[0024] In a second aspect, an embodiment of the present application proposes an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to call the computer program to execute the above-mentioned video processing method.

[0025] In a third aspect, an embodiment of the present application proposes a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed, the above-mentioned video processing method is implemented.

[0026] In a fourth aspect, an embodiment of the present application proposes a computer program product, including a computer program, which enables a computer to execute the above-mentioned video processing method when the computer program is executed.

[0027] The possible implementation methods of the second to fourth aspects have effects similar to those of the first aspect and the possible designs of the first aspect, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A schematic diagram of the hardware system structure of an electronic device provided in an embodiment of the present application;

[0029] Figure 2 A schematic diagram of the software system structure of an electronic device provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of the interface during the video cropping process provided by an embodiment of the present application;

[0031] Figure 4 A schematic diagram of mirroring and rotating a video screen in a video cropping interface provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of rebounding a video screen after dragging it in a video cropping interface provided in an embodiment of the present application;

[0033] Figure 6 A schematic diagram of rebounding and zooming in on a video screen after zooming out in a video cropping interface provided in an embodiment of the present application;

[0034] Figure 7 A flowchart of a video processing method provided in an embodiment of the present application;

[0035] Figure 8 A flowchart of a video processing method during video picture rotation provided by an embodiment of the present application;

[0036] Fig. 9 A schematic diagram of calculating a first critical scaling ratio required when a video picture is enlarged during rotation of the video picture in an embodiment of the present application;

[0037] Fig.10 It is a schematic diagram of the embodiment of the present application when the cropping frame is dragged in different ways;

[0038] Fig.11 This is a schematic diagram of calculating the drag boundary of the cropping frame when the video screen is not rotated according to an embodiment of the present application;

[0039] Fig.12 This is a schematic diagram of calculating the drag boundary of the cropping frame after the video screen is rotated according to an embodiment of the present application;

[0040] Fig.13 A flowchart of a video processing method after dragging a video screen provided by an embodiment of the present application;

[0041] Fig.14 This is a schematic diagram of determining whether the cropping frame is completely located within the dragged video screen after the video screen is dragged according to an embodiment of the present application;

[0042] Fig.15 A schematic diagram of calculating a rebound distance of a video screen after dragging the video screen in an embodiment of the present application;

[0043] Fig.16 A schematic diagram of calculating another rebound distance of a video screen after dragging the video screen in an embodiment of the present application;

[0044] Fig.17 A flowchart of a video processing method after scaling a video image provided by an embodiment of the present application;

[0045] Fig.18 A schematic diagram of calculating a second critical scaling ratio required when the video picture is enlarged after scaling the video picture in an embodiment of the present application;

[0046] Fig.19 This is a schematic diagram of updating the axis point of a video screen after a drag operation is performed on the scaled video screen according to an embodiment of the present application;

[0047] Fig. 20 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.

[0049] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0050] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0051] When a user uses an electronic device, the electronic device can be used to shoot a video, and after shooting the video, the user can edit the shot video so that the edited video can better meet the user's personalized needs. Then, the electronic device can save the edited video to a storage device. In this way, when the user needs to browse or use the edited video, the electronic device can read the edited video from the storage device and display it for the user to browse and view.

[0052] For example, after shooting a video, in response to the user using a cropping frame to crop the video frame, the video frame within the cropping frame is cropped out. The cropping frame refers to a view operation frame used to crop the frame in a video cropping function of a video editing application.

[0053] In some scenarios, users can rotate, scale, and translate (also called drag) the video screen. In the related art, when a cropping frame is used to crop the video screen that has been rotated, scaled, dragged, etc., part of the cropping frame may be outside the video screen, that is, the cropping frame includes part of the non-video screen, resulting in the appearance of non-video screen outside the video screen in the cropped video, affecting the effect of the cropped video.

[0054] Based on this, the embodiment of the present application provides a video processing method. When performing mobile operations such as rotating, scaling, and dragging on the video screen displayed in the video cropping interface, it will be determined whether the cropping frame is completely located in the video screen. If there is an area outside the video screen in the cropping frame, the video screen can be adjusted according to the adjustment parameters corresponding to the mobile operation so that the cropping frame is completely located in the adjusted video screen. Therefore, when the embodiment of the present application uses the cropping frame to crop the video screen that has been rotated, scaled, and dragged, the video screen can be adjusted by adjusting the parameters so that the cropping frame is completely located in the adjusted video screen, that is, the cropping frame no longer includes non-video screens, so that non-video screens outside the video screen will not appear in the cropped video, thereby improving the effect of the cropped video.

[0055] The electronic device provided in the embodiment of the present application may be a mobile phone, a tablet computer (Pad), a wearable device, a vehicle-mounted device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., which are electronic devices with video processing capabilities. The embodiment of the present application does not limit the specific technology and specific device form used by the electronic device.

[0056] In order to better understand the embodiments of the present application, the structure of the electronic device according to the embodiments of the present application is introduced below.

[0057] For example, Figure 1The structural diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.

[0058] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0059] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0060] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0061] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0062] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0063] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.

[0064] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0065] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0066] The display screen 194 is used to display images, display videos, and receive sliding operations, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0067] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0068] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0069] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0070] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0071] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0072] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0073] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0074] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0075] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0076] A touch sensor is also called a "touch control device". The touch sensor can be arranged on the display screen 194. The touch sensor and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0077] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0078] The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195.

[0079] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.

[0080] Figure 2 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0081] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer, application framework layer, system library and hardware layer.

[0082] The application layer can include a series of application packages, such as phone, email, calendar, music and other applications.

[0083] In the embodiments of the present application, Figure 2As shown, the application layer also includes a video editing application. The video editing application has video data processing capabilities and can provide users with video editing functions, including video data processing such as cropping and rendering. Among them, in the embodiment of the present application, a video editing application can be used to determine whether the cropping frame in the video cropping interface is entirely within the video screen when performing moving operations such as dragging, scaling, and rotating the video screen, and when there is an area outside the video screen in the cropping frame, the video screen is adjusted according to the first critical scaling ratio corresponding to the rotation operation, the second critical scaling ratio corresponding to the scaling operation, and the rebound distance corresponding to the dragging operation. Adjustment parameters such as the adjustment parameters adjust the video screen so that the cropping frame is entirely within the adjusted video screen. In addition, the video editing application can also calculate the drag boundary of the cropping frame that is allowed to be dragged, and update the axis point of the video screen after dragging the scaled video screen.

[0084] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0085] like Figure 2 As shown, the application framework layer may include a media framework and an application framework.

[0086] The media framework provides multiple tools for editing video and audio. Among them, the above tools include MediaCodec. MediaCodec is a module provided by Android for encoding and decoding audio and video. It includes encoders, decoders, and surface type caches.

[0087] The encoder provided by MeidaCodec can convert the video or audio in one format input to the encoder into another format through compression technology, while the decoder is used to perform the reverse process of encoding, converting the video or audio in one format input to the decoder into another format through decompression technology.

[0088] MediaCodec can also apply for a shared memory, which is the surface memory in the hardware layer (hereinafter referred to as surface). Surface can be used to cache video data. For example, after an electronic device performs an editing operation and obtains a rendered video image frame, the electronic device can input the image frame into the surface cache. Then, the application can obtain the rendered video image frame from the surface for storage or display, etc.

[0089] The media framework also includes a shared memory management module (surface flinger), which is used to overlay and mix the view surfaces of multiple App windows into one view surface according to the hierarchical order of the screen display, and put it into the cache area. When the screen refreshes the screen at a certain frequency, the view in the cache area can be displayed on the display.

[0090] The application framework (FrameWork) can manage the window processing events and actions of each current application App, and communicate data with SurfaceFlinger; it can also process the work events or method calls of the application App, and respond accordingly according to the requirements of the App.

[0091] The system library can include multiple functional modules. Figure 2 As shown, the system library may include a rendering module, which can be used to implement three-dimensional graphics drawing, image rendering, synthesis and layer processing, etc. As an example and not a limitation, the rendering module includes but is not limited to at least one of the following: open graphics library (OpenGL), open source computer vision library (OpenCV), open computing language library (OpenCL).

[0092] The rendering module provides multiple image rendering functions, which can be used to draw simple graphics to complex three-dimensional scenes. In the embodiment of the present application, the rendering module provided by the system library can be used to support the video editing application to perform image editing operations, such as video cropping operations, adding filters, etc.

[0093] As an example, the system library may also include other functional modules, such as: status monitoring service, surface manager, media libraries, etc.

[0094] The hardware layer includes memory, graphics processing unit (GPU) and video memory. Memory can be used to temporarily store the operation data in the central processing unit (CPU) and the data exchanged with external storage such as hard disk. Memory also includes the shared memory (surface) mentioned above. The storage space required for electronic devices to run video editing applications can be provided by memory, for example, surface.

[0095] The GPU is a processor that performs image and graphics related operations. In the embodiment of the present application, the process of video cropping by the electronic device using the rendering module can be completed by the GPU. The video memory is used to store the rendered picture data after each GPU calculation.

[0096] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0097] In actual usage scenarios, users can open videos through video editing applications so that electronic devices can display Figure 3 The video editing interface 300 shown in (a) of FIG. The video editing interface 300 displays a video screen 301 corresponding to the video, and the video editing interface 300 also includes a variety of functional controls for video editing, such as a cropping control 302, a filter control, a text control, and a special effect control.

[0098] When the user needs to crop the video, the user can operate the cropping control 302, and the electronic device responds to the user operation on the cropping control 302, so that the electronic device displays the following Figure 3 The video cropping interface 400 shown in (b) in FIG.

[0099] Among them, the video cropping interface 400 also displays the video screen 301 corresponding to the video, and a cropping frame 401 is also provided in the video cropping interface. The cropping frame 401 refers to the view operation box for cropping the video screen in the video cropping function of the video editing application, which is used to crop the video screen.

[0100] The video cropping interface 400 also includes an aspect control, which is used to change the width and / or height of the cropping frame 401, thereby changing the width and / or height of the video image within the cropping frame 401, that is, to change the width and / or height of the cropped video image. For example, the aspect control may include but is not limited to the following controls: a "free" aspect control, an "original ratio" aspect control, a "9:16" aspect control, a "16:9" aspect control, and a "3:4" aspect control.

[0101] The "Free" frame control is used to adjust the width and / or height of the cropping frame 401. The aspect ratio of the cropping frame 401 can be changed arbitrarily according to actual needs, that is, the aspect ratio of the cropping frame 401 is not fixed. The "Original Ratio" frame control is used to adjust the width and height of the cropping frame 401. The aspect ratio of the cropping frame 401 remains fixed at the preset aspect ratio. The preset aspect ratio can be the aspect ratio of the video screen before cropping, or other preset ratios. The "9:16" frame control is used to adjust the width and height of the cropping frame 401 according to a fixed aspect ratio of 9:16. The "16:9" frame control is used to adjust the width and height of the cropping frame 401 according to a fixed aspect ratio of 16:9. The "3:4" frame control is used to adjust the width and height of the cropping frame 401 according to a fixed aspect ratio of 3:4.

[0102] In addition, the video cropping interface 400 further includes a first rotation control 402 , a second rotation control 403 , and a mirror control 404 .

[0103] The first rotation control 402 may also be referred to as a rulerView control. The first rotation control 402 is used to rotate the video screen according to the angle scale value selected by the user operation when receiving a user operation. Exemplarily, the rotation angle range of the first rotation control 402 is -45° to +45°. When the first rotation control 402 is slid to the right, the video screen rotates clockwise. When the first rotation control 402 is slid to the left, the video screen rotates counterclockwise. Therefore, when the user slides the first rotation control 402, the rotation angle of the video screen can be adjusted according to actual needs. For example, the video screen can be rotated 10° or 30° clockwise according to actual needs.

[0104] The second rotation control 403 is used to rotate the video screen at a fixed angle when receiving a user operation. For example, each time the user clicks the second rotation control 403, the video screen can be rotated 90° counterclockwise or 90° clockwise. The mirror control 404 is used to perform a mirror operation on the video screen when receiving a user operation.

[0105] For example, when the user clicks on the "free" frame control and adjusts the width and height of the cropping frame 401 to the size required by the user by dragging the border or vertex of the cropping frame 401, the user can click on the confirmation control 405 in the video cropping interface 400, and the electronic device responds to the user operation on the confirmation control 405, so that the electronic device displays the following Figure 3 The video editing interface 300 shown in (c) of FIG. Figure 3 The video editing interface 300 shown in (c) in FIG. 1 shows the cropped video screen 303. When the electronic device jumps to Figure 3After viewing the video editing interface 300 shown in (c) in FIG. 1 , the user may continue to click other editing function buttons to perform editing, or may also end the video editing operation.

[0106] In actual use, after the electronic device displays the video cropping interface 400, the user can perform one or more of the following operations on the video screen.

[0107] For example, Figure 4 As shown in (a) in FIG. 1 , the user can perform a touch operation on the mirror control 404 in the video cropping interface 400 , and the electronic device responds to the user operation on the mirror control 404 to implement a mirroring operation on the video screen 301 .

[0108] like Figure 4 As shown in (b) in FIG. 4 , the user may also perform a touch operation on the first rotation control 402 in the video cropping interface 400 to realize a rotation operation on the video screen 301. In addition, during the rotation process, it is determined whether the cropping frame 401 is entirely within the video screen 301 during the rotation process. When the cropping frame 401 is entirely within the video screen 301 during the rotation process, the video screen 301 remains unchanged. When there is an area in the cropping frame 401 that is outside the video screen 301 during the rotation process, the electronic device may enlarge the video screen 301 during the rotation process according to the first critical zoom ratio, so that the cropping frame 401 is entirely within the enlarged video screen 301.

[0109] Of course, the user can perform a touch operation on the second rotation control 403 in the video cropping interface 400 to achieve an operation of rotating the video screen by an integer multiple of 90°.

[0110] like Figure 5 As shown in (a) in the figure, the user can also drag the video screen 301 displayed in the cropping frame 401 by performing a single-finger drag operation on the video screen 301 in the cropping frame 401. After the user's dragging operation ends, the user's finger will leave the screen of the electronic device, and the electronic device needs to determine whether the cropping frame 401 is completely located in the video screen 301 after dragging. When the cropping frame 401 is completely located in the video screen 301 after dragging, the video screen 301 remains in its original state. When there is an area in the cropping frame 401 that is outside the video screen 301 after dragging, the electronic device can rebound the video screen 301 after dragging according to the rebound distance, that is, the video screen 301 moves from Figure 5 The state shown in (a) rebounds to Figure 5 The state shown in (b) finally makes the cropping frame 401 completely located within the video screen 301 after rebounding.

[0111] The user can also zoom in or out the video image 301 displayed in the cropping frame 401 by performing a pinch-zoom operation on the video image 301 in the cropping frame 401, such as Figure 6 As shown in (a) of FIG. 1 , the user performs a zoom operation on the video screen 301 displayed in the cropping frame 401. After the user's zooming operation is completed, the user's finger will leave the screen of the electronic device, and the electronic device needs to determine whether the cropping frame 401 is entirely within the zoomed video screen 301. When the cropping frame 401 is entirely within the zoomed video screen 301, the video screen 301 remains the same. When there is an area outside the zoomed video screen 301 in the cropping frame 401, the electronic device can zoom in on the zoomed video screen according to the second critical zoom ratio, that is, the video screen 301 is zoomed out from Figure 6 The state shown in (a) is enlarged and rebounded to Figure 6 The state shown in (b) finally makes the cropping frame 401 completely located within the video screen 301 after the zoom-in rebound.

[0112] For example, Figure 7 This is a flow chart of a video processing method provided in an embodiment of the present application. The video processing method can be specifically executed by a video editing application in an electronic device. Figure 7 As shown, the video processing method may specifically include the following steps:

[0113] Step 701: The electronic device receives a movement operation on a video screen displayed in a video cropping interface; the movement operation includes at least one of a rotation operation, a zoom operation, and a drag operation.

[0114] In some embodiments, the user can slide the first rotation control 402 in the video cropping interface 400, or the user can click the second rotation control 403 in the video cropping interface 400, so that the electronic device can receive a rotation operation on the video screen 301 displayed in the video cropping interface 400.

[0115] The user may also perform a single-finger drag operation on the video image 301 within the cropping frame 401 , so that the electronic device receives the drag operation on the video image 301 displayed in the video cropping interface 400 .

[0116] The user can also perform a two-finger zoom operation on the video image 301 in the cropping frame 401 , so that the electronic device receives the zoom operation on the video image 301 displayed in the video cropping interface 400 .

[0117] Step 702: In response to the moving operation, the electronic device determines whether all the cropping frames in the video cropping interface are located within the video screen.

[0118] Take the rotation operation of the video screen 301 as an example. During the rotation process, the electronic device determines whether the cropping frame 401 is completely located in the rotating video screen 301. When the cropping frame 401 is completely located in the rotating video screen 301, the video screen 301 remains the same, and the electronic device does not change the size of the video screen 301.

[0119] Take the drag operation on the video screen 301 as an example. After the user's drag operation ends, the electronic device will determine whether the cropping frame 401 is completely located in the video screen 301 after dragging. When the cropping frame 401 is completely located in the video screen 301 after dragging, the video screen 301 remains in its original state, and the electronic device does not rebound the video screen 301.

[0120] Take the zoom operation on the video screen 301 as an example. After the user's zoom operation is completed, the electronic device will determine whether the cropping frame 401 is completely located in the zoomed video screen 301. When the cropping frame 401 is completely located in the zoomed video screen 301, the video screen 301 remains the same, and the electronic device does not zoom in on the video screen 301.

[0121] Step 703: when there is an area outside the video screen in the cropping frame, the electronic device adjusts the video screen according to the adjustment parameters corresponding to the moving operation, so that the cropping frame is completely located within the adjusted video screen.

[0122] Taking the rotation operation on the video screen 301 as an example, the adjustment parameter corresponding to the rotation operation includes a first critical zoom ratio. When there is an area outside the video screen 301 during the rotation in the cropping frame 401, the electronic device can enlarge the video screen 301 during the rotation according to the first critical zoom ratio, so that the cropping frame 401 is completely located in the enlarged video screen 301.

[0123] Taking the drag operation on the video screen 301 as an example, the adjustment parameters corresponding to the drag operation include the rebound distance. When there is an area outside the dragged video screen 301 in the cropping frame 401, the electronic device can rebound the dragged video screen 301 according to the rebound distance, so that the cropping frame 401 is completely located in the rebounded video screen 301.

[0124] Taking the zoom operation on the video screen 301 as an example, the adjustment parameter corresponding to the zoom operation includes the second critical zoom ratio. When there is an area outside the zoomed video screen 301 in the cropping frame 401, the electronic device can zoom in the zoomed video screen according to the second critical zoom ratio, so that the cropping frame 401 is completely located in the zoomed video screen 301.

[0125] Therefore, when the embodiment of the present application uses the cropping frame 401 to crop the video screen 301 that has undergone operations such as rotation, scaling, and dragging, the video screen 301 can be adjusted by adjusting parameters so that the cropping frame 401 is entirely located within the adjusted video screen 301, that is, the cropping frame 401 no longer includes non-video images, so that non-video images other than the video screen 301 will not appear in the cropped video, thereby improving the effect of the cropped video.

[0126] In addition, in addition to the above-mentioned operations of rotating, scaling, and dragging the video screen 301, the embodiment of the present application can also adjust the video screen by adjusting parameters, and can also calculate the drag boundary of the cropping frame 401 that allows dragging, and update the axis point of the video screen 301 after dragging the scaled video screen 301.

[0127] The following specifically introduces the specific implementation method of the embodiment of the present application from five aspects: rotation of the video screen 301, dragging of the cropping frame 401, dragging of the video screen 301, scaling of the video screen 301, and updating of the axis point of the video screen 301.

[0128] For example, Figure 8 The flowchart of the video processing method in the video screen rotation process provided by the embodiment of the present application is mainly based on the rotation scene when the first rotation control 402 is triggered as an example. Figure 8 As shown, the video processing method in the process of video picture rotation may specifically include the following steps:

[0129] Step 801, the electronic device receives a touch operation on a first rotation control in a video cropping interface; the first rotation control is used to rotate the video screen according to an angle scale value corresponding to the touch operation when triggered.

[0130] In some embodiments, when the user wants to rotate the video screen 301 displayed in the video cropping interface 400, the user can slide the first rotation control 402 in the video cropping interface 400 so that the electronic device receives the touch operation on the first rotation control 402 in the video cropping interface 400.

[0131] The first rotation control 402 may also be called a rulerView control, and the rotation angle range of the first rotation control 402 may be -45° to +45°. The first rotation control 402 is used to rotate the video screen according to the angle scale value corresponding to the touch operation when triggered.

[0132] After each click of the mirror control 404, the degree of the first rotation control 402 will change, and the change rule is newRulerAngle=-1×oldRulerAngle, oldRulerAngle refers to the degree of the first rotation control 402 before clicking the mirror control 404, and newRulerAngle refers to the degree of the first rotation control 402 after clicking the mirror control 404.

[0133] The rotation operation refers to rotating the videoView (i.e., the video screen 301) around the Z axis. When performing the rotation operation, the video editing application can call the mVideoView.setRotation(degree) interface. The mirroring operation refers to rotating the video screen 301 around the Y axis by 0 degrees or 180 degrees. When performing the mirroring operation, the video editing application can call the mVideoView.setRotationY(0 / 180) interface.

[0134] It should be noted that the width direction of the cropping frame 401 may be regarded as the X-axis, the height direction of the cropping frame 401 may be regarded as the Y-axis, and the Z-axis refers to a coordinate axis perpendicular to both the X-axis and the Y-axis.

[0135] Step 802 : In response to the touch operation, the electronic device obtains the first vertex coordinates of each vertex in the video image during the rotation process and the second vertex coordinates of each vertex in the cropping frame.

[0136] Step 803: The electronic device calculates a first critical scaling ratio of the video image according to the first vertex coordinates and the second vertex coordinates.

[0137] After receiving a touch operation on the first rotation control 402 in the video cropping interface 400, the electronic device obtains the first vertex coordinates of each vertex in the video screen 301 during the rotation process and the second vertex coordinates of each vertex in the cropping frame 401 in response to the touch operation; then, based on the first vertex coordinates and the second vertex coordinates, the electronic device calculates the first critical scaling ratio of the video screen 301.

[0138] The first critical zoom ratio refers to the zoom factor of the video screen 301 when the video screen 301 just fills the cropping frame 401 at the current rotation angle. The video screen 301 just fills the cropping frame 401, which can be understood as the cropping frame 401 does not include non-video images outside the video screen 301, and at least one vertex in the cropping frame 401 is located at the boundary line of the video screen 301.

[0139] In an optional implementation, the electronic device calculates a first line formed between every two adjacent vertices in the video screen 301 according to the first vertex coordinates of each vertex in the video screen 301; the electronic device calculates a second line formed between the center point of the cropping frame 401 and each vertex in the cropping frame 401 according to the second vertex coordinates of each vertex in the cropping frame 401; the electronic device calculates an intersection formed between a first line corresponding to a first target vertex and a corresponding second line to obtain a target intersection corresponding to the first target vertex, the first target vertex is any vertex in the cropping frame 401, the first line corresponding to the first target vertex is the first line closest to the first target vertex in the video screen 301, and the second line corresponding to the first target vertex is the second line formed between the first target vertex and the center point of the cropping frame 401; the electronic device calculates a first spacing between the first target vertex and the center point of the cropping frame 401, and a second spacing between the target intersection and the center point of the cropping frame 401; the electronic device calculates a first critical scaling ratio of the video screen according to the first spacing and the second spacing.

[0140] Specifically, the electronic device determines the ratio of the first spacing to the second spacing as the target ratio value corresponding to the first target vertex; the electronic device determines the maximum value of the target ratio values ​​corresponding to each vertex in the cropping frame 401 as the first critical scaling ratio of the video screen 301.

[0141] For example, Fig. 9 As shown, the four vertices in the video picture 301 during the rotation process are respectively P1 vertex, P2 vertex, P3 vertex and P4 vertex, and the vertices in the cropping frame 401 are respectively C1 vertex, C2 vertex, C3 vertex and C4 vertex.

[0142] According to the calculation formula for determining a straight line from two points, based on the first vertex coordinates corresponding to the P1 vertex, the P2 vertex, the P3 vertex, and the P4 vertex in the video screen 301, the first connecting line formed between every two adjacent vertices in the video screen 301 can be obtained. Among them, the first connecting line included in the video screen 301 can be understood as four boundary lines in the video screen 301, including: the boundary line formed between the P1 vertex and the P2 vertex, the boundary line formed between the P2 vertex and the P3 vertex, the boundary line formed between the P3 vertex and the P4 vertex, and the boundary line formed between the P1 vertex and the P4 vertex.

[0143] center is the center point of the cropping frame 401. With the upper left corner of the screen as the coordinate origin, the horizontal coordinate of the center point of the cropping frame 401 can be: the horizontal coordinate of the C1 vertex + the width of the cropping frame / 2, and the vertical coordinate of the center point of the cropping frame 401 can be: the vertical coordinate of the C1 vertex + the height of the cropping frame / 2. Alternatively, the horizontal coordinate of the center point of the cropping frame 401 can be: (the horizontal coordinate of the C2 vertex-the horizontal coordinate of the C1 vertex) / 2+the horizontal coordinate of the C1 vertex, and the vertical coordinate of the center point of the cropping frame 401 can be: the vertical coordinate of the C4 vertex-the vertical coordinate of the C1 vertex) / 2+the vertical coordinate of the C1 vertex.

[0144] According to the calculation formula for determining a straight line from two points, based on the second vertex coordinates corresponding to the C1 vertex, the C2 vertex, the C3 vertex, and the C4 vertex in the cropping frame 401, and the coordinates of the center point center of the cropping frame 401, the second connection line formed between the center point center of the cropping frame 401 and each vertex in the cropping frame 401 can be obtained. Among them, the second connection line formed between the center point center of the cropping frame 401 and each vertex in the cropping frame 401 includes: the connection line formed between the center point center of the cropping frame 401 and the C1 vertex, the connection line formed between the center point center of the cropping frame 401 and the C2 vertex, the connection line formed between the center point center of the cropping frame 401 and the C3 vertex, and the connection line formed between the center point center of the cropping frame 401 and the C4 vertex.

[0145] According to the above method, the straight line formulas corresponding to the 8 lines can be calculated, and according to the corresponding relationship, the intersection of the first line and the second line can be calculated by the calculation formula for the intersection of two lines. Among them, the intersection of the first line and the second line includes S1 intersection, S2 intersection, S3 intersection and S4 intersection.

[0146] like Fig. 9As shown in (a) in the figure, for the video screen 301 that is not mirrored, and the scene where the first rotation control 402 slides to the right, that is, the scene where rulerAngle (referring to the change in the rotation angle caused by the sliding operation on the first rotation control 402) is greater than 0. Taking the first target vertex as the C1 vertex as an example, the first connecting line corresponding to the first target vertex is the boundary line of the P1 vertex-P4 vertex, the second connecting line corresponding to the first target vertex is the connecting line of the center-C1 vertex, and the intersection between the connecting line of the center-C1 vertex and the boundary line of the P1 vertex-P4 vertex is the S1 intersection. Taking the first target vertex as the C2 vertex as an example, the first connecting line corresponding to the first target vertex is the boundary line of the P1 vertex-P2 vertex, the second connecting line corresponding to the first target vertex is the connecting line of the center-C2 vertex, and the intersection between the connecting line of the center-C2 vertex and the boundary line of the P1 vertex-P2 vertex is the S2 intersection. Taking the first target vertex as C3 vertex as an example, the first line corresponding to the first target vertex is the boundary line between P2 vertex and P3 vertex, the second line corresponding to the first target vertex is the line between center and C3 vertex, and the intersection between the line between center and C3 vertex and the boundary line between P2 vertex and P3 vertex is the S3 intersection. Taking the first target vertex as C4 vertex as an example, the first line corresponding to the first target vertex is the boundary line between P3 vertex and P4 vertex, the second line corresponding to the first target vertex is the line between center and C4 vertex, and the intersection between the line between center and C4 vertex and the boundary line between P3 vertex and P4 vertex is the S4 intersection.

[0147] like Fig. 9 As shown in (b), for the video screen 301 that is not mirrored, and the scene where the first rotary control 402 slides to the left, that is, the scene where rulerAngle is less than 0. The intersection point between the line connecting the center-C1 vertices and the boundary line between the P1 vertex and the P2 vertex is the S1 intersection point, the intersection point between the line connecting the center-C2 vertices and the boundary line between the P2 vertex and the P3 vertex is the S2 intersection point, the intersection point between the line connecting the center-C3 vertices and the boundary line between the P3 vertex and the P4 vertex is the S3 intersection point, and the intersection point between the line connecting the center-C4 vertices and the boundary line between the P1 vertex and the P4 vertex is the S4 intersection point.

[0148] Then, the electronic device calculates the first distances corresponding to the four vertices of the cropping frame 401 and the center point center of the cropping frame 401, that is, it calculates the first distance between the C1 vertex and the center point center of the cropping frame 401, the first distance between the C2 vertex and the center point center of the cropping frame 401, the first distance between the C3 vertex and the center point center of the cropping frame 401, and the first distance between the C4 vertex and the center point center of the cropping frame 401.

[0149] In addition, the electronic device calculates the second distances corresponding to the above-mentioned four intersection points and the center point center of the cropping frame 401, that is, the second distance between the S1 intersection point and the center point center of the cropping frame 401, the second distance between the S2 intersection point and the center point center of the cropping frame 401, the second distance between the S3 intersection point and the center point center of the cropping frame 401, and the second distance between the S4 intersection point and the center point center of the cropping frame 401.

[0150] Next, the ratio of each first spacing to the corresponding second spacing is calculated to obtain the target ratio values ​​corresponding to the four vertices in the cropping frame 401. The four target ratio values ​​calculated are: the first spacing between the C1 vertex and the center point center of the cropping frame 401 is divided by the second spacing between the S1 intersection and the center point center of the cropping frame 401 to obtain the target ratio value; the first spacing between the C2 vertex and the center point center of the cropping frame 401 is divided by the second spacing between the S2 intersection and the center point center of the cropping frame 401 to obtain the target ratio value; the first spacing between the C3 vertex and the center point center of the cropping frame 401 is divided by the second spacing between the S3 intersection and the center point center of the cropping frame 401 to obtain the target ratio value; the first spacing between the C4 vertex and the center point center of the cropping frame 401 is divided by the second spacing between the S4 intersection and the center point center of the cropping frame 401 to obtain the target ratio value.

[0151] Finally, the maximum value among the target ratio values ​​calculated above is determined as the first critical scaling ratio of the video picture 301 .

[0152] In other embodiments, after calculating the S1 intersection, S2 intersection, S3 intersection and S4 intersection between the first line and the second line, the third distance between the S1 intersection and the S3 intersection, the fourth distance between the S2 intersection and the S4 intersection, the fifth distance between the C1 vertex and the C3 vertex, and the sixth distance between the C2 vertex and the C4 vertex can also be calculated; then, the ratio of the fifth distance to the third distance and the ratio of the sixth distance to the fourth distance are calculated; finally, the maximum value of the ratio of the fifth distance to the third distance and the ratio of the sixth distance to the fourth distance is determined as the first critical scaling ratio of the video screen 301.

[0153] Step 804: The electronic device determines whether the cropping frame is completely located within the rotating video picture according to the first critical scaling ratio and the first scaling ratio of the rotating video picture relative to the original video picture.

[0154] In some embodiments, the electronic device also needs to obtain a first scaling ratio of the current video image relative to the original video image during the rotation process.

[0155] The original video screen refers to the video screen when the video cropping interface 400 is first displayed. Since the video screen is scaled proportionally when it is scaled, the first scaling ratio may be the ratio of the width of the current video screen to the original width of the original video screen, or the first scaling ratio may be the ratio of the height of the current video screen to the original height of the original video screen.

[0156] Specifically, when the first critical zoom ratio is greater than the first zoom ratio, the electronic device determines that there is an area in the cropping frame 401 that is outside the video screen 301 during the rotation process; when the first critical zoom ratio is less than or equal to the first zoom ratio, the electronic device determines that the cropping frame 401 is entirely within the video screen 301 during the rotation process.

[0157] When the cropping frame 401 is completely within the rotating video screen 301, the video screen 301 remains unchanged and the electronic device does not change the size of the video screen 301. When there is an area outside the rotating video screen 301 in the cropping frame 401, the electronic device executes the following step 805.

[0158] Step 805 , when there is an area in the cropping frame outside the rotating video picture, the electronic device zooms in the rotating video picture according to the first critical zoom ratio so that the cropping frame is completely located in the zoomed video picture.

[0159] In some embodiments, when there is an area in the cropping frame 401 that is outside the video screen 301 during the rotation process, in order to make the cropping frame 401 no longer include non-video screens other than the video screen 301, the electronic device may call a first critical scaling ratio to enlarge the video screen 301 during the rotation process, so that the cropping frame 401 is entirely located within the enlarged video screen 301.

[0160] When the first critical scaling ratio is used to enlarge the video picture 301 in the process of rotation, the video picture 301 is also enlarged in proportion, that is, the enlargement ratios of the width and height of the video picture 301 are both the first critical scaling ratio.

[0161] In some scenarios, the embodiment of the present application can also perform a click operation on the second rotation control 403 in the video cropping interface 400, so that the electronic device receives the touch operation on the second rotation control 403 in the video cropping interface 400. The second rotation control 403 is used to rotate the video screen 301 by an integer multiple of 90 degrees according to the number of clicks when triggered.

[0162] Each time the second rotation control 403 is clicked, the video screen 301 rotates 90° counterclockwise, that is, -90° is superimposed on the original angle. When the video screen 301 is not mirrored, that is, when mirror=0, the video screen 301 rotates counterclockwise after multiple clicks on the second rotation control 403, and the rotation angles are 0°, -90°, -180°, and -270°, respectively; when the video screen 301 is mirrored, that is, when mirror=180°, the video screen 301 rotates clockwise after multiple clicks on the second rotation control 403, and the rotation angles are 0°, 90°, 180°, and 270°, respectively.

[0163] Therefore, when rotating the video screen 301, it is necessary to call setRotation(degree) to set the rotation angle. The rotation angle includes the rotation angle corresponding to the sliding operation on the first rotation control 402 and the rotation angle corresponding to the click operation on the second rotation control 403, that is, degree=rotation+rulerAngle. Rotation refers to the change in the rotation angle caused by the click operation on the second rotation control 403.

[0164] For a scene where the aspect ratio of the cropping frame 401 is 1:1, when the video screen 301 is rotated by an integer multiple of 90°, the electronic device will not enlarge the size of the video screen 301 .

[0165] For the scene where the aspect ratio of the cropping frame 401 is not 1:1, that is, the width and height of the cropping frame 401 are not equal. If the video screen 301 is rotated 90°, both the width and height of the cropping frame 401 may change, that is, the width of the cropping frame 401 after the change is the height of the cropping frame 401 before the change, and the height of the cropping frame 401 after the change is the width of the cropping frame 401 before the change. Accordingly, the width and height of the video screen 301 also need to change according to the ratio of the cropping frame 401.

[0166] Before the video screen 301 is rotated, if the aspect ratio of the cropping frame 401 is greater than the aspect ratio of the operable area, the zoom ratio of the video screen 301 after rotation is: the ratio of the height of the operable area to the width of the operable area. Before the video screen 301 is rotated, if the aspect ratio of the cropping frame 401 is less than the aspect ratio of the operable area, the zoom ratio of the video screen 301 after rotation is: the ratio of the width of the operable area to the height of the operable area. The operable area refers to the maximum area of ​​the cropping frame 401 that can respond to the user's gesture operation.

[0167] In some optional implementations, when using the video cropping function, the user may also adjust the size and position of the cropping frame 401 according to the actual position to be cropped in the video screen 301 , which may be achieved by dragging the cropping frame 401 .

[0168] Dragging the cropping frame is an important component function of video cropping. The cropping frame 401 has four boundary lines and four vertices. When a boundary line or a vertex of the cropping frame 401 is dragged with a single finger, the corresponding processing method will be different depending on the touch position.

[0169] In order to ensure that when the boundary line or vertex of the cropping frame 401 is dragged, the cropping can be performed according to the current frame ratio, so the dragging of the cropping frame 401 is processed in two cases: one is a free frame scenario, and the other is a fixed frame scenario.

[0170] Free frame (such as the scene when clicking the "free" frame control) means that the cropping frame 401 does not need to be dragged according to a fixed ratio. The aspect ratio of the cropping frame 401 can be changed at will during dragging. The dragging position is within the allowed dragging range. After exceeding the dragging range, the previous position can be maintained. Fixed frame refers to proportionally reducing or enlarging the cropping frame 401 according to a fixed frame ratio (such as 9:16 and 3:4 frame ratios).

[0171] Taking a fixed frame as an example, in one scenario, the user can drag any of the four boundary lines of the cropping frame 401 to proportionally reduce or enlarge the width and height of the cropping frame 401. At this time, the position of the dragged boundary line relative to the boundary line remains unchanged. Fig.10 As shown in (a), 401a is the cropping frame before dragging. The lower boundary line of the cropping frame can be dragged upward, and the position of the upper boundary line of the cropping frame remains unchanged. 401b is the cropping frame after the boundary line is dragged. It can be seen that the aspect ratio of the cropping frame before and after dragging is the same.

[0172] Taking a fixed frame as an example, in another scenario, the user can also drag any of the four vertices of the cropping frame 401 to proportionally reduce or enlarge the width and height of the cropping frame 401. At this time, the position of the vertex on the diagonal line of the dragged vertex remains unchanged. Fig.10 As shown in (b), 401a is the cropping frame before dragging. The lower left vertex of the cropping frame can be dragged toward the upper right vertex, and the position of the upper right vertex of the cropping frame remains unchanged. 401c is the cropping frame after the vertex is dragged. It can be seen that the aspect ratio of the cropping frame before and after dragging is the same.

[0173] It should be noted that the cropping frame 401 will be restricted by some dragging boundaries during the dragging process, that is, the dragging boundary needs to meet the following three conditions: 1. When the cropping frame 401 is reduced, its width cannot be less than the minimum width of the cropping frame 401, and its height cannot be less than the minimum height of the cropping frame 401. The minimum width and the minimum height are determined by the view control corresponding to the cropping frame 401; 2. The dragging boundary cannot exceed the maximum range that the cropping frame 401 can display (i.e., the operating area). The maximum range that the cropping frame 401 can display can be that the upper boundary is below the title bar, the lower boundary is above the "reset" control in the video cropping interface 400, the left boundary is a preset first distance from the left edge of the screen, and the right boundary is a preset second distance from the right edge of the screen. The first distance and the second distance can be equal, that is, the maximum width that the cropping frame 401 can display = the width of the parent layout - the left and right spacing, and the maximum height that the cropping frame 401 can display = the height of the parent layout - the upper and lower spacing - the height of the title bar - the height of the control bar (such as the "reset" control).

[0174] like Fig.11 As shown, the first rectangular box 63 represents the area where the enlarged video screen is located, the second rectangular box 64 (i.e., the parent layout) represents the maximum range that the cropping box 401 can display, the third rectangular box 65 represents the position of the cropping box 401 before dragging, and the fourth rectangular box 66 represents the dragging boundary of the cropping box 401 that is allowed to be dragged.

[0175] Therefore, the left boundary of the drag boundary can be the maximum value of the coordinate values ​​of the left boundaries of the first rectangular frame 63 and the second rectangular frame 64, that is, the left boundary of the first rectangular frame 63 is the left boundary of the drag boundary. The right boundary of the drag boundary can be the minimum value of the coordinate values ​​of the right boundaries of the first rectangular frame 63 and the second rectangular frame 64, that is, the right boundary of the second rectangular frame 64 is the right boundary of the drag boundary. The upper boundary of the drag boundary can be the maximum value of the coordinate values ​​of the upper boundaries of the first rectangular frame 63 and the second rectangular frame 64, that is, the upper boundary of the first rectangular frame 63 is the upper boundary of the drag boundary. The lower boundary of the drag boundary can be the minimum value of the coordinate values ​​of the lower boundaries of the first rectangular frame 63 and the second rectangular frame 64, that is, the lower boundary of the second rectangular frame 64 is the lower boundary of the drag boundary).

[0176] The above description is for the scenario where the rotation angle of the video screen 301 is 0° or an integer multiple of 90°, and the corresponding method of determining the drag boundary. In this case, the area boundary of the video screen 301 can be compared with the boundary of the maximum range that the cropping frame 401 can display, and the upper boundary, lower boundary, left boundary and right boundary, etc. can be selected therefrom.

[0177] When the rotation angle of the video screen 301 is not 0° and not an integer multiple of 90°, the electronic device may determine the drag boundary in the following manner.

[0178] When the rotation angle of the video screen 301 is not 0° and is not an integer multiple of 90°, the electronic device receives a drag operation on the cropping frame 401; the electronic device obtains the fifth vertex coordinates of each vertex in the video screen 301 in response to the drag operation; the electronic device calculates the fourth line formed between every two adjacent vertices in the video screen 301 based on the fifth vertex coordinates of each vertex in the video screen 301; the electronic device calculates the drag boundary of the cropping frame 401 based on the coordinates of the intersection formed by the extended lines of the four boundary lines in the cropping frame 401 and the fourth line; the drag boundary is the boundary corresponding to the maximum range of dragging allowed for the cropping frame 401.

[0179] For example, Fig.12 As shown, the four vertices in the video picture 301 are respectively the P1 vertex, the P2 vertex, the P3 vertex and the P4 vertex, and the vertices in the cropping frame 401 are respectively the C1 vertex, the C2 vertex, the C3 vertex and the C4 vertex.

[0180] According to the calculation formula for determining a straight line from two points, based on the fifth vertex coordinates corresponding to the P1 vertex, the P2 vertex, the P3 vertex, and the P4 vertex in the video screen 301, the fourth connecting line formed between every two adjacent vertices in the video screen 301 can be obtained. Among them, the fourth connecting lines included in the video screen 301 are: the boundary line formed between the P1 vertex and the P2 vertex, the boundary line formed between the P2 vertex and the P3 vertex, the boundary line formed between the P3 vertex and the P4 vertex, and the boundary line formed between the P1 vertex and the P4 vertex.

[0181] Correspondingly, based on the C1 vertex, C2 vertex, C3 vertex and C4 vertex in the cropping frame 401, four boundary lines in the cropping frame 401 can be obtained, which are the boundary line formed between the C1 vertex and the C2 vertex, the boundary line formed between the C2 vertex and the C3 vertex, the boundary line formed between the C3 vertex and the C4 vertex, and the boundary line formed between the C1 vertex and the C4 vertex.

[0182] According to the above method, the straight line formulas corresponding to the 8 boundary lines can be obtained. According to the corresponding relationship, the straight line formulas corresponding to the 8 boundary lines can be obtained. The 8 intersection points can be calculated by the calculation formula of the intersection point of two straight lines.

[0183] like Fig.12As shown in (a), for the scenario where rulerAngle is greater than 0. The intersection point between the extension line of the boundary line between C1 and C4 and the boundary line between P1 and P4 is the Q1 intersection point, the intersection point between the extension line of the boundary line between C1 and C4 and the boundary line between P3 and P4 is the Q2 intersection point; the intersection point between the extension line of the boundary line between C2 and C3 and the boundary line between P1 and P2 is the Q3 intersection point, and the intersection point between the extension line of the boundary line between C2 and C3 and the boundary line between P2 and P3 is the Q4 intersection point; The intersection point between the extension line of the boundary line between vertex C1 and vertex C2 and the boundary line between vertex P1 and vertex P4 is the Q5 intersection point, and the intersection point between the extension line of the boundary line between vertex C1 and vertex C2 and the boundary line between vertex P1 and vertex P2 is the Q6 intersection point; the intersection point between the extension line of the boundary line between vertex C3 and vertex C4 and the boundary line between vertex P3 and vertex P4 is the Q7 intersection point, and the intersection point between the extension line of the boundary line between vertex C3 and vertex C4 and the boundary line between vertex P2 and vertex P3 is the Q8 intersection point.

[0184] The drag boundary on the left side of the cropping frame 401 is the maximum value of the horizontal coordinate of the intersection point Q5 and the horizontal coordinate of the intersection point Q7, that is, Fig.12 The drag boundary on the right side of the cropping frame 401 is the minimum value of the horizontal coordinates of the intersection points Q6 and Q8, that is, Fig.12 The horizontal coordinate of the Q8 intersection shown in (a) of FIG. The drag boundary on the upper side of the cropping frame 401 is the maximum value of the vertical coordinates of the Q1 intersection and the Q3 intersection, that is, Fig.12 The vertical coordinate of the Q1 intersection shown in (a) of FIG. The drag boundary at the lower side of the cropping frame 401 is the minimum value of the vertical coordinate of the Q2 intersection and the vertical coordinate of the Q4 intersection, that is, Fig.12 The ordinate of the Q4 intersection shown in (a) is shown in FIG. Therefore, Fig.12 The four black bold lines shown in (a) in FIG. 4 represent the dragging boundaries of the cropping frame 401 .

[0185] like Fig.12As shown in (b), for the scenario where rulerAngle is less than 0. The intersection point between the extension line of the boundary line between C1 and C4 and the boundary line between P1 and P2 is the Q1 intersection point, the intersection point between the extension line of the boundary line between C1 and C4 and the boundary line between P1 and P4 is the Q2 intersection point; the intersection point between the extension line of the boundary line between C2 and C3 and the boundary line between P2 and P3 is the Q3 intersection point, the intersection point between the extension line of the boundary line between C2 and C3 and the boundary line between P3 and P4 is the Q4 intersection point; The intersection point between the extension line of the boundary line between vertex C1 and vertex C2 and the boundary line between vertex P1 and vertex P2 is the Q5 intersection point, the intersection point between the extension line of the boundary line between vertex C1 and vertex C2 and the boundary line between vertex P2 and vertex P3 is the Q6 intersection point; the intersection point between the extension line of the boundary line between vertex C3 and vertex C4 and the boundary line between vertex P1 and vertex P4 is the Q7 intersection point, and the intersection point between the extension line of the boundary line between vertex C3 and vertex C4 and the boundary line between vertex P3 and vertex P4 is the Q8 intersection point.

[0186] The drag boundary on the left side of the cropping frame 401 is the maximum value of the horizontal coordinate of the intersection point Q5 and the horizontal coordinate of the intersection point Q7, that is, Fig.12 The drag boundary on the right side of the cropping frame 401 is the minimum value of the horizontal coordinates of the intersection points Q6 and Q8, that is, Fig.12 The horizontal coordinate of the Q6 intersection shown in (b) of FIG. The drag boundary on the upper side of the cropping frame 401 is the maximum value of the vertical coordinates of the Q1 intersection and the Q3 intersection, that is, Fig.12 The vertical coordinate of the Q3 intersection shown in (b) of FIG. The drag boundary at the lower side of the cropping frame 401 is the minimum value of the vertical coordinate of the Q2 intersection and the vertical coordinate of the Q4 intersection, that is, Fig.12 The ordinate of the Q2 intersection point shown in (b) is shown in FIG. Therefore, Fig.12 The four black bold lines shown in (b) in FIG. 4 represent the dragging boundaries of the cropping frame 401 .

[0187] In an embodiment of the present application, the electronic device can determine the operation type according to the position of the user's finger touch. When the position of the user's finger touch is located on the boundary line or vertex of the cropping frame 401, it can be determined that the operation type is to drag the cropping frame 401; when the position of the single finger touch is located inside the cropping frame 401, it can be determined that the operation type is a drag operation on the video screen 301; when the position of the two fingers touch is located inside the cropping frame 401, it can be determined that the operation type is a zoom operation on the video screen 301. Therefore, when it is determined that the operation type is to drag the cropping frame 401, the drag boundary of the cropping frame 401 can be determined in the above manner.

[0188] For example, Fig.13A flowchart of a video processing method after dragging a video screen provided by an embodiment of the present application. Fig.13 As shown, the video processing method after the video screen is dragged may specifically include the following steps:

[0189] Step 1301: The electronic device receives a drag operation on a video image displayed in a video cropping interface.

[0190] In some embodiments, when a user wants to translate the video screen 301 displayed in the video cropping interface 400, the user can touch the video screen 301 in the cropping frame 401 with one finger and drag the video screen 301 in a certain direction, and the electronic device can receive the drag operation on the video screen 301 displayed in the video cropping interface 400.

[0191] During the process of dragging the video screen 301, it is necessary to pay attention to the following two points: one is that during the process of dragging the video screen 301, the finger cannot leave the video screen 301 displayed on the screen; the other is that after the dragging is completed and the finger leaves the screen, a rebound mechanism needs to be added so that the cropping frame 401 is filled with the video screen 301, that is, no content other than the video screen 301 will appear in the cropping frame 401.

[0192] Step 1302: In response to the dragging operation, the electronic device obtains the third vertex coordinates of each vertex in the dragged video image and the fourth vertex coordinates of each vertex in the cropping frame.

[0193] Step 1303: The electronic device determines whether the cropping frame is completely located within the dragged video screen according to the third vertex coordinates and the fourth vertex coordinates.

[0194] In some embodiments, after receiving a drag operation on the video screen 301, the electronic device may respond to the drag operation and determine whether the cropping frame 401 is entirely within the video screen 301 after the drag according to the third vertex coordinates of each vertex in the video screen 301 after the drag and the fourth vertex coordinates of each vertex in the cropping frame 401.

[0195] If the cropping frame 401 is completely within the dragged video screen 301 , the electronic device does not rebound the video screen 301 , and the video screen 301 remains unchanged.

[0196] After the dragging operation on the video screen 301 is completed and the user's finger leaves the screen, the electronic device can determine whether the cropping frame 401 is completely located within the dragged video screen 301 in the following two cases.

[0197] In the first case, the scene where rulerAngle is equal to 0, that is, the rotation angle of the video screen 301 at this time is 0° or an integer multiple of 90°. In this case, the electronic device compares the upper boundary value of the dragged video screen 301 with the upper boundary value of the cropping frame 401, compares the lower boundary value of the dragged video screen 301 with the lower boundary value of the cropping frame 401, compares the left boundary value of the dragged video screen 301 with the left boundary value of the cropping frame 401, and compares the right boundary value of the dragged video screen 301 with the right boundary value of the cropping frame 401.

[0198] When the left boundary value of the cropping frame 401 is greater than or equal to the left boundary value of the video screen 301 after dragging, the right boundary value of the cropping frame 401 is less than or equal to the right boundary value of the video screen 301 after dragging, the upper boundary value of the cropping frame 401 is greater than or equal to the upper boundary value of the video screen 301 after dragging, and the lower boundary value of the cropping frame 401 is less than or equal to the lower boundary value of the video screen 301 after dragging, it is determined that the cropping frame 401 is entirely located within the video screen 301 after dragging.

[0199] When at least one of the above four determination conditions is not met, it is determined that there is an area outside the dragged video screen 301 in the cropping frame 401 .

[0200] The left boundary value of the cropping frame 401 refers to the horizontal coordinates of the upper left vertex and the lower left vertex of the cropping frame 401, and the left boundary value of the video screen 301 refers to the horizontal coordinates of the upper left vertex and the lower left vertex of the video screen 301. The right boundary value of the cropping frame 401 refers to the horizontal coordinates of the upper right vertex and the lower right vertex of the cropping frame 401, and the right boundary value of the video screen 301 refers to the horizontal coordinates of the upper right vertex and the lower right vertex of the video screen 301. The upper boundary of the cropping frame 401 refers to the vertical coordinates of the upper left vertex and the upper right vertex of the cropping frame 401, and the upper boundary value of the video screen 301 refers to the vertical coordinates of the upper left vertex and the upper right vertex of the video screen 301. The lower boundary value of the cropping frame 401 refers to the vertical coordinates of the lower left vertex and the lower right vertex of the cropping frame 401, and the lower boundary value of the video screen 301 refers to the vertical coordinates of the lower left vertex and the lower right vertex of the video screen 301.

[0201] It should be noted that after the video screen 301 is rotated 90° counterclockwise, the upper left vertex of the video screen 301 in the visual sense is actually the upper right vertex of the video screen 301, the lower left vertex of the video screen 301 in the visual sense is actually the upper left vertex of the video screen 301, the lower right vertex of the video screen 301 in the visual sense is actually the lower left vertex of the video screen 301, and the upper right vertex of the video screen 301 in the visual sense is actually the lower right vertex of the video screen 301. This solution is aimed at the case where the video screen 301 is rotated but the rotation angle is an integer multiple of 90°, and the coordinates of each vertex in the visual sense are compared with the vertex coordinates of the cropping frame 401 to determine whether to rebound, and calculate the rebound distance when rebound is required.

[0202] The second case is the scene where rulerAngle is not equal to 0, that is, the rotation angle of the video screen 301 is not 0° and is not an integer multiple of 90°. In this case, the electronic device calculates the third line formed between each adjacent two vertices in the video screen 301 based on the third vertex coordinates of each vertex in the video screen 301; the electronic device calculates the vertical point coordinates from each vertex in the cropping frame 401 to the corresponding third line; the electronic device determines whether the cropping frame 401 is completely located in the video screen 301 after dragging based on the vertical point coordinates and the fourth vertex coordinates.

[0203] like Fig.14 As shown, after the dragging operation ends, the four vertices in the video screen 301 are respectively the P1 vertex, the P2 vertex, the P3 vertex and the P4 vertex, and the vertices in the cropping frame 401 are respectively the C1 vertex (i.e., the upper left vertex), the C2 vertex (i.e., the upper right vertex), the C3 vertex (i.e., the lower right vertex) and the C4 vertex (i.e., the lower left vertex).

[0204] According to the calculation formula for determining a straight line from two points, based on the third vertex coordinates corresponding to the P1 vertex, the P2 vertex, the P3 vertex, and the P4 vertex in the video screen 301, the third connecting line formed between every two adjacent vertices in the video screen 301 can be obtained. Among them, the third connecting line corresponding to the video screen 301 includes: the boundary line formed between the P1 vertex and the P2 vertex, the boundary line formed between the P2 vertex and the P3 vertex, the boundary line formed between the P3 vertex and the P4 vertex, and the boundary line formed between the P1 vertex and the P4 vertex.

[0205] The electronic device calculates the coordinates of the vertical points from each vertex in the cropping frame 401 to the corresponding third connecting line, that is, the coordinates of the vertical points from the C1 vertex, the C2 vertex, the C3 vertex, and the C4 vertex in the cropping frame 401 to the corresponding third connecting line. The vertical points corresponding to the four vertices in the cropping frame 401 are drop14, drop12, drop23, and drop34, respectively. The electronic device determines whether the cropping frame 401 is completely located within the dragged video screen 301 according to the fourth vertex coordinates corresponding to the four vertices in the cropping frame 401 and the vertical point coordinates of the vertical points corresponding to the four vertices.

[0206] like Fig.14 As shown in (a) in the figure, for the scenario where rulerAngle is greater than 0, the drop14 vertical point is the vertical point on the boundary line from the C1 vertex to the P1 vertex-P4 vertex, the drop12 vertical point is the vertical point on the boundary line from the C2 vertex to the P1 vertex-P2 vertex, the drop23 vertical point is the vertical point on the boundary line from the C3 vertex to the P2 vertex-P3 vertex, and the drop34 vertical point is the vertical point on the boundary line from the C4 vertex to the P3 vertex-P4 vertex.

[0207] like Fig.14 As shown in (b) of the figure, for the scenario where rulerAngle is less than 0, the drop14 vertical point is the vertical point on the boundary line from the C4 vertex to the P1 vertex-P4 vertex, the drop12 vertical point is the vertical point on the boundary line from the C1 vertex to the P1 vertex-P2 vertex, the drop23 vertical point is the vertical point on the boundary line from the C2 vertex to the P2 vertex-P3 vertex, and the drop34 vertical point is the vertical point on the boundary line from the C3 vertex to the P3 vertex-P4 vertex.

[0208] When the horizontal coordinates of the C1 vertex and the C4 vertex are greater than or equal to the horizontal coordinate of the drop14 vertical point, the vertical coordinates of the C1 vertex and the C2 vertex are greater than or equal to the vertical coordinate of the drop12 vertical point, the horizontal coordinates of the C2 vertex and the C3 vertex are less than or equal to the horizontal coordinate of the drop23 vertical point, and the vertical coordinates of the C3 vertex and the C4 vertex are less than or equal to the vertical coordinate of the drop34 vertical point, it is determined that the cropping frame 401 is entirely located within the video screen 301 after dragging.

[0209] When at least one of the above four determination conditions is not met, it is determined that there is an area outside the dragged video screen 301 in the cropping frame 401 .

[0210] Step 1304: when there is an area in the cropping frame that is outside the dragged video screen, the electronic device rebounds the dragged video screen according to the rebound distance so that the cropping frame is completely within the rebounded video screen.

[0211] In some embodiments, when there is an area in the cropping frame 401 that is outside the dragged video screen 301, in order to make the cropping frame 401 no longer include non-video screens other than the video screen 301, the electronic device may call the rebound distance to perform a rebound operation on the dragged video screen 301, so that the cropping frame 401 is entirely located within the video screen 301 after the rebound.

[0212] Therefore, before performing a rebound operation on the dragged video screen 301, the electronic device needs to first calculate the rebound distance of the video screen 301. The electronic device can calculate the rebound distance of the video screen 301 separately in the following two cases.

[0213] In the first case, the scene where rulerAngle is equal to 0, that is, the rotation angle of the video screen 301 at this time is 0° or an integer multiple of 90°. In this case, the electronic device determines the fifth target vertex that is closest to the center point of the cropping frame 401 among the vertices in the dragged video screen 301; the electronic device calculates the rebound distance based on the fourth vertex coordinates corresponding to the vertex in the cropping frame 401 that is consistent with the fifth target vertex orientation, and the third vertex coordinates corresponding to the fifth target vertex.

[0214] If the fifth target vertex closest to the center point of the cropping frame 401 among the vertices in the dragged video screen 301 is the upper left vertex of the video screen 301, then the vertex in the cropping frame 401 that is aligned with the fifth target vertex is the upper left vertex of the cropping frame 401. Therefore, when the horizontal coordinate of the upper left vertex of the video screen 301 is greater than the horizontal coordinate of the upper left vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to the difference between the horizontal coordinate of the upper left vertex of the cropping frame 401 and the horizontal coordinate of the upper left vertex of the video screen 301; when the horizontal coordinate of the upper left vertex of the video screen 301 is less than or equal to the horizontal coordinate of the upper left vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to 0. When the ordinate of the upper left vertex of the video screen 301 is greater than the ordinate of the upper left vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to the difference between the ordinates of the upper left vertex of the cropping frame 401 and the upper left vertex of the video screen 301; when the ordinate of the upper left vertex of the video screen 301 is less than or equal to the ordinate of the upper left vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to 0.

[0215] If the fifth target vertex closest to the center point of the cropping frame 401 among the vertices in the dragged video screen 301 is the upper right vertex of the video screen 301, then the vertex in the cropping frame 401 that is aligned with the fifth target vertex is the upper right vertex of the cropping frame 401. Therefore, when the horizontal coordinate of the upper right vertex of the video screen 301 is less than the horizontal coordinate of the upper right vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to the difference between the horizontal coordinate of the upper right vertex of the cropping frame 401 and the horizontal coordinate of the upper right vertex of the video screen 301; when the horizontal coordinate of the upper right vertex of the video screen 301 is greater than or equal to the horizontal coordinate of the upper right vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to 0. When the ordinate of the upper right vertex of the video screen 301 is greater than the ordinate of the upper right vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to the difference between the ordinates of the upper right vertex of the cropping frame 401 and the upper right vertex of the video screen 301; when the ordinate of the upper right vertex of the video screen 301 is less than or equal to the ordinate of the upper right vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to 0.

[0216] If, among the vertices in the dragged video screen 301, the fifth target vertex closest to the center point of the cropping frame 401 is the lower right vertex of the video screen 301, then the vertex in the cropping frame 401 that is aligned with the fifth target vertex is the lower right vertex of the cropping frame 401. Therefore, when the horizontal coordinate of the lower right vertex of the video screen 301 is less than the horizontal coordinate of the lower right vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to the difference between the horizontal coordinate of the lower right vertex of the cropping frame 401 and the horizontal coordinate of the lower right vertex of the video screen 301; when the horizontal coordinate of the lower right vertex of the video screen 301 is greater than or equal to the horizontal coordinate of the lower right vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to 0. When the ordinate of the lower right vertex of the video screen 301 is smaller than the ordinate of the lower right vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to the difference between the ordinates of the lower right vertex of the cropping frame 401 and the lower right vertex of the video screen 301; when the ordinate of the lower right vertex of the video screen 301 is greater than or equal to the ordinate of the lower right vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to 0.

[0217] If the fifth target vertex closest to the center point of the cropping frame 401 among the vertices in the dragged video screen 301 is the lower left vertex of the video screen 301, then the vertex in the cropping frame 401 that is aligned with the fifth target vertex is the lower left vertex of the cropping frame 401. Therefore, when the horizontal coordinate of the lower left vertex of the video screen 301 is greater than the horizontal coordinate of the lower left vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to the difference between the horizontal coordinate of the lower left vertex of the cropping frame 401 and the horizontal coordinate of the lower left vertex of the video screen 301; when the horizontal coordinate of the lower left vertex of the video screen 301 is less than or equal to the horizontal coordinate of the lower left vertex of the cropping frame 401, the rebound distance in the X-axis direction is equal to 0. When the ordinate of the lower left vertex of the video screen 301 is smaller than the ordinate of the lower left vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to the difference between the ordinates of the lower left vertex of the cropping frame 401 and the lower left vertex of the video screen 301; when the ordinate of the lower left vertex of the video screen 301 is greater than or equal to the ordinate of the lower left vertex of the cropping frame 401, the rebound distance in the Y-axis direction is equal to 0.

[0218] The second case is a scene where rulerAngle is not equal to 0, that is, the rotation angle of the video screen 301 is not 0° and is not an integer multiple of 90°. In this case, the electronic device determines the second target vertex that is closest to the center point of the cropping frame 401 among the vertices in the dragged video screen 301; the electronic device obtains the critical coordinates of the critical point corresponding to the second target vertex, and the critical point is consistent with the orientation of the second target vertex; the electronic device determines whether the number of vertices in the cropping frame 401 that are outside the dragged video screen 301 is greater than 1 based on the third vertex coordinates corresponding to the second target vertex, the critical coordinates corresponding to the critical point, the fourth vertex coordinates corresponding to the third target vertex, and the vertical point coordinates corresponding to the two target vertical points. Among them, the third target vertex is the vertex in the cropping frame 401 that is consistent with the orientation of the second target vertex, and the target vertical point is the two vertices corresponding to the second target vertex in the cropping frame 401, to the vertical points on the two boundary lines adjacent to the second target vertex in the video screen 301.

[0219] When at least two vertices in the cropping frame 401 are outside the dragged video screen 301, the electronic device uses the deviation distance between the critical point and the second target vertex as the rebound distance. When a vertex in the cropping frame is outside the dragged video screen 301, the electronic device obtains the fourth vertex coordinates corresponding to the fourth target vertex in the cropping frame 401 that is outside the video screen 301; the electronic device uses the deviation distance between the fourth vertex coordinates corresponding to the fourth target vertex and the vertical point coordinates of the corresponding target vertical point as the rebound distance.

[0220] In the first case, for each vertex in the dragged video screen 301, the second target vertex closest to the center point of the cropping frame 401 is the upper left vertex (i.e., the P1 vertex) of the video screen 301. The third target vertex in the cropping frame 401 is the upper left vertex (i.e., the C1 vertex) in the cropping frame 401, and the two target vertical points are the drop14 vertical point and the drop12 vertical point.

[0221] Therefore, the electronic device can determine whether the number of vertices in the cropping frame 401 located outside the dragged video screen 301 is greater than 1 based on the third vertex coordinates corresponding to the P1 vertex, the critical coordinates of the critical point corresponding to the P1 vertex, the fourth vertex coordinates corresponding to the C1 vertex, the vertical point coordinates of the drop14 vertical point, and the vertical point coordinates of the drop12 vertical point.

[0222] The critical point corresponding to the P1 vertex may be called the upper left critical point leftTop, which may be calculated based on the fourth vertex coordinate of the C1 vertex in the cropping frame 401, the width or height of the cropping frame 401, and the rotation angle (i.e., rulerAngle) of the video screen 301 triggered by the first rotation control 402. Specifically, when rulerAngle is greater than 0, the abscissa of the upper left critical point leftTop is equal to the abscissa of the C1 vertex +wSin, and the ordinate of the upper left critical point leftTop is equal to the ordinate of the C1 vertex -wCos; when rulerAngle is less than 0, the abscissa of the upper left critical point leftTop is equal to the abscissa of the C1 vertex -hCos, and the ordinate of the upper left critical point leftTop is equal to the ordinate of the C1 vertex +hSin. Among them, wSin=width of cropping frame 401×sin(rulerAngle)×sin(rulerAngle), wCos=width of cropping frame 401×sin(rulerAngle)×cos(rulerAngle), hSin=height of cropping frame 401×sin(rulerAngle)×sin(rulerAngle), hCos=height of cropping frame 401×sin(rulerAngle)×sin(rulerAngle), hCos=height of cropping frame 401 sin(rulerAngle)×cos(rulerAngle).

[0223] When the third vertex coordinates corresponding to the P1 vertex and the critical coordinates of the upper left critical point leftTop meet the first condition, it is determined that at least two vertices in the cropping frame 401 are located outside the dragged video screen 301. Among them, when the horizontal coordinate of the P1 vertex is greater than the horizontal coordinate of the upper left critical point leftTop, and the vertical coordinate of the P1 vertex is greater than the vertical coordinate of the upper left critical point leftTop, it meets the first condition; when the horizontal coordinate of the P1 vertex is less than or equal to the horizontal coordinate of the upper left critical point leftTop, and / or the vertical coordinate of the P1 vertex is less than or equal to the vertical coordinate of the upper left critical point leftTop, it does not meet the first condition.

[0224] When the third vertex coordinates corresponding to the P1 vertex and the critical coordinates of the upper left critical point leftTop do not meet the first condition, continue to determine whether they meet the second condition based on the fourth vertex coordinates corresponding to the C1 vertex, the vertical point coordinates of the drop14 vertical point, and the vertical point coordinates of the drop12 vertical point. When the second condition is met, determine that at least two vertices in the cropping box 401 are outside the dragged video screen 301. When the second condition is still not met, determine that one vertex in the cropping box 401 is outside the dragged video screen 301.

[0225] Among them, when the abscissa of the C1 vertex is smaller than the abscissa of the drop14 perpendicular point, and the ordinate of the C1 vertex is smaller than the ordinate of the drop12 perpendicular point, it meets the second condition; when the abscissa of the C1 vertex is greater than or equal to the abscissa of the drop14 perpendicular point, and / or the ordinate of the C1 vertex is greater than or equal to the ordinate of the drop12 perpendicular point, it does not meet the second condition.

[0226] When the first or second condition is met, the electronic device uses the deviation distance between the upper left critical point leftTop and the P1 vertex as the rebound distance, that is, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the upper left critical point leftTop minus the horizontal coordinate of the P1 vertex, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the upper left critical point leftTop minus the vertical coordinate of the P1 vertex.

[0227] like Fig.15 As shown, 301a represents the video screen before rebound after dragging, and the C1 vertex and the C2 vertex in the cropping frame 401 are both outside the video screen. After the dragging operation is completed, the upper left vertex P1 of the video screen is rebounded to the upper left critical point leftTop, and 301b represents the video screen after rebound.

[0228] In the case where the first and second conditions mentioned above are not met. When the horizontal coordinate of the C1 vertex is less than the horizontal coordinate of the drop14 vertical point, the vertical coordinate of the C1 vertex is greater than or equal to the vertical coordinate of the drop12 vertical point, and rulerAngle is greater than 0, it means that the fourth target vertex in the cropping frame 401 is the C1 vertex, therefore, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the C1 vertex - the horizontal coordinate of the drop14 vertical point, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the C1 vertex - the vertical coordinate of the drop14 vertical point. When the horizontal coordinate of the C1 vertex is less than the horizontal coordinate of the drop14 vertical point, the vertical coordinate of the C1 vertex is greater than or equal to the vertical coordinate of the drop12 vertical point, and rulerAngle is less than 0, it means that the fourth target vertex in the cropping frame 401 is the C4 vertex, therefore, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the C4 vertex - the horizontal coordinate of the drop14 vertical point, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the C4 vertex - the vertical coordinate of the drop14 vertical point.

[0229] In the case where the first and second conditions mentioned above are not met. When the horizontal coordinate of the C1 vertex is greater than or equal to the horizontal coordinate of the drop14 vertical point, and the vertical coordinate of the C1 vertex is less than the vertical coordinate of the drop12 vertical point, and rulerAngle is greater than 0, it means that the fourth target vertex in the cropping frame 401 is the C2 vertex, therefore, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the C2 vertex - the horizontal coordinate of the drop12 vertical point, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the C2 vertex - the vertical coordinate of the drop12 vertical point. When the horizontal coordinate of the C1 vertex is greater than or equal to the horizontal coordinate of the drop14 vertical point, and the vertical coordinate of the C1 vertex is less than the vertical coordinate of the drop12 vertical point, and rulerAngle is less than, it means that the fourth target vertex in the cropping frame 401 is the C1 vertex, therefore, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the C1 vertex - the horizontal coordinate of the drop12 vertical point, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the C1 vertex - the vertical coordinate of the drop12 vertical point.

[0230] like Fig.16 As shown, 301a represents the video screen before rebounding after dragging, and the C1 vertex in the cropping frame 401 is located outside the video screen. After the dragging operation is completed, the drop14 vertical point of the video screen rebounds to the C1 vertex.

[0231] In the second case, for each vertex in the dragged video screen 301, the second target vertex closest to the center point of the cropping frame 401 is the upper right vertex (i.e., the P2 vertex) of the video screen 301. The third target vertex in the cropping frame 401 is the upper right vertex (i.e., the C2 vertex) in the cropping frame 401, and the two target vertical points are the drop23 vertical point and the drop12 vertical point.

[0232] The critical point corresponding to the P2 vertex can be called the upper right critical point rightTop. When rulerAngle is greater than 0, the abscissa of the upper right critical point rightTop is equal to the abscissa of the C2 vertex + hCos, and the ordinate of the upper right critical point rightTop is equal to the ordinate of the C2 vertex + hSin; when rulerAngle is less than 0, the abscissa of the upper right critical point rightTop is equal to the abscissa of the C2 vertex -wSin, and the ordinate of the upper right critical point rightTop is equal to the ordinate of the C2 vertex -wCos.

[0233] When the horizontal coordinate of the P2 vertex is less than the horizontal coordinate of the upper right critical point rightTop, and the vertical coordinate of the P2 vertex is greater than the vertical coordinate of the upper right critical point rightTop, it meets the first condition, otherwise it does not meet the first condition. Further, when the vertical coordinate of the C2 vertex is less than the vertical coordinate of the drop12 vertical point, and the horizontal coordinate of the C2 vertex is greater than the horizontal coordinate of the drop23 vertical point, it meets the second condition.

[0234] When the first or second condition is met, the electronic device uses the deviation distance between the upper right critical point rightTop and the P2 vertex as the rebound distance, that is, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the upper right critical point rightTop minus the horizontal coordinate of the P2 vertex, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the upper right critical point rightTop minus the vertical coordinate of the P2 vertex.

[0235] When the first and second conditions mentioned above are not met. When the horizontal coordinate of the C2 vertex is less than or equal to the horizontal coordinate of the drop23 vertical point, and the vertical coordinate of the C2 vertex is less than the vertical coordinate of the drop12 vertical point, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the drop12 vertical point x12-, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the C2 vertex-the vertical coordinate of the drop12 vertical point. Among them, when rulerAngle is greater than 0, x12 represents the horizontal coordinate of the C2 vertex; when rulerAngle is less than 0, x12 represents the horizontal coordinate of the C1 vertex.

[0236] In the case where the first and second conditions mentioned above are not met. When the horizontal coordinate of the C2 vertex is greater than the horizontal coordinate of the drop23 vertical point, and the vertical coordinate of the C2 vertex is greater than or equal to the vertical coordinate of the drop12 vertical point, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the C2 vertex - the horizontal coordinate of the drop23 vertical point, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of y23 - the vertical coordinate of the drop23 vertical point. Among them, when rulerAngle is greater than 0, y23 represents the vertical coordinate of the C3 vertex; when rulerAngle is less than 0, y23 represents the vertical coordinate of the C2 vertex.

[0237] In the third case, for each vertex in the dragged video screen 301, the second target vertex closest to the center point of the cropping frame 401 is the lower right vertex (i.e., the P3 vertex) of the video screen 301. The third target vertex in the cropping frame 401 is the lower right vertex (i.e., the C3 vertex) in the cropping frame 401, and the two target vertical points are the drop34 vertical point and the drop23 vertical point.

[0238] The critical point corresponding to the P3 vertex can be called the lower right critical point rightBottom. When rulerAngle is greater than 0, the abscissa of the lower right critical point rightBottom = the abscissa of the C3 vertex - wSin, and the ordinate of the lower right critical point rightBottom = the ordinate of the C3 vertex + wCos; when rulerAngle is less than 0, the abscissa of the lower right critical point rightBottom = the abscissa of the C3 vertex + hCos, and the ordinate of the lower right critical point rightBottom = the ordinate of the C3 vertex - hSin.

[0239] When the horizontal coordinate of the P3 vertex is less than the horizontal coordinate of the lower right critical point rightBottom, and the vertical coordinate of the P3 vertex is less than the vertical coordinate of the lower right critical point rightBottom, it meets the first condition, otherwise it does not meet the first condition. Further, when the vertical coordinate of the C3 vertex is greater than the vertical coordinate of the drop34 vertical point, and the horizontal coordinate of the C3 vertex is greater than the horizontal coordinate of the drop23 vertical point, it meets the second condition.

[0240] When the first or second condition is met, the electronic device uses the deviation distance between the lower right critical point rightBottom and the P3 vertex as the rebound distance, that is, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the lower right critical point rightBottom minus the horizontal coordinate of the P3 vertex, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the lower right critical point rightBottom minus the vertical coordinate of the P3 vertex.

[0241] When the first and second conditions mentioned above are not met. When the ordinate of the C3 vertex is greater than the ordinate of the drop34 vertical point, and the abscissa of the C3 vertex is less than or equal to the abscissa of the drop23 vertical point, the rebound distance in the X-axis direction is equal to x34-the abscissa of the drop34 vertical point, and the rebound distance in the Y-axis direction is equal to the ordinate of the C3 vertex-the ordinate of the drop34 vertical point. Among them, when rulerAngle is greater than 0, x34 represents the abscissa of the C4 vertex; when rulerAngle is less than 0, x34 represents the abscissa of the C3 vertex.

[0242] In the case where the first and second conditions mentioned above are not met. When the horizontal coordinate of the C3 vertex is greater than the horizontal coordinate of the drop23 vertical point, and the vertical coordinate of the C3 vertex is less than or equal to the vertical coordinate of the drop34 vertical point, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the C3 vertex - the horizontal coordinate of the drop23 vertical point, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of y23 - the vertical coordinate of the drop23 vertical point. Among them, when rulerAngle is greater than 0, y23 represents the vertical coordinate of the C3 vertex; when rulerAngle is less than 0, y23 represents the vertical coordinate of the C2 vertex.

[0243] In the fourth case, for each vertex in the dragged video screen 301, the second target vertex closest to the center point of the cropping frame 401 is the lower left vertex (i.e., the P4 vertex) of the video screen 301. The third target vertex in the cropping frame 401 is the lower left vertex (i.e., the C4 vertex) in the cropping frame 401, and the two target vertical points are the drop34 vertical point and the drop14 vertical point.

[0244] The critical point corresponding to the P4 vertex can be called the lower left critical point leftBottom. When rulerAngle is greater than 0, the abscissa of the lower left critical point leftBottom = the abscissa of the C4 vertex - hCos, and the ordinate of the lower left critical point leftBottom = the ordinate of the C4 vertex - hSin; when rulerAngle is less than 0, the abscissa of the lower left critical point leftBottom = the abscissa of the C4 vertex + wSin, and the ordinate of the lower left critical point leftBottom = the ordinate of the C4 vertex + wCos.

[0245] When the horizontal coordinate of the P4 vertex is greater than the horizontal coordinate of the lower left critical point leftBottom, and the vertical coordinate of the P4 vertex is less than the vertical coordinate of the lower left critical point leftBottom, it meets the first condition, otherwise it does not meet the first condition. Further, when the horizontal coordinate of the C4 vertex is less than the horizontal coordinate of the drop14 vertical point, and the vertical coordinate of the C4 vertex is greater than the vertical coordinate of the drop34 vertical point, it meets the second condition.

[0246] When the first or second condition is met, the electronic device uses the deviation distance between the lower left critical point leftBottom and the P4 vertex as the rebound distance, that is, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the lower left critical point leftBottom minus the horizontal coordinate of the P4 vertex, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of the lower left critical point leftBottom minus the vertical coordinate of the P4 vertex.

[0247] In the case where the first and second conditions mentioned above are not met. When the horizontal coordinate of the C4 vertex is less than the horizontal coordinate of the drop14 vertical point, and the vertical coordinate of the C4 vertex is less than or equal to the vertical coordinate of the drop34 vertical point, the rebound distance in the X-axis direction is equal to the horizontal coordinate of the C4 vertex - the horizontal coordinate of the drop14 vertical point, and the rebound distance in the Y-axis direction is equal to the vertical coordinate of y14 - the vertical coordinate of the drop14 vertical point. Among them, when rulerAngle is greater than 0, y14 represents the vertical coordinate of the C1 vertex; when rulerAngle is less than 0, y14 represents the vertical coordinate of the C4 vertex.

[0248] When the first and second conditions mentioned above are not met. When the ordinate of the C4 vertex is greater than the ordinate of the drop34 vertical point, and the abscissa of the C4 vertex is greater than or equal to the abscissa of the drop14 vertical point, the rebound distance in the X-axis direction is equal to x34-the abscissa of the drop34 vertical point, and the rebound distance in the Y-axis direction is equal to the ordinate of the C4 vertex-the ordinate of the drop34 vertical point. Among them, when rulerAngle is greater than 0, x34 represents the abscissa of the C4 vertex; when rulerAngle is less than 0, x34 represents the abscissa of the C3 vertex.

[0249] For example, Fig.17 A flowchart of a video processing method after video image scaling provided by an embodiment of the present application. Fig.17 As shown, the video processing method after the video picture is scaled may specifically include the following steps:

[0250] Step 1701: The electronic device receives a zooming operation on a video image displayed in a video cropping interface.

[0251] In some embodiments, when a user wants to zoom in or out on the video screen 301 displayed in the video cropping interface 400, the user can touch the video screen 301 in the cropping frame 401 with two fingers, and slide the two fingers in a direction gradually moving away or closer, and the electronic device can receive the zoom operation on the video screen 301 displayed in the video cropping interface 400.

[0252] Among them, after the user touches the video screen 301 in the cropping frame 401 with two fingers, when the distance between the two fingers gradually increases, the video screen 301 is zoomed in, and when the distance between the two fingers gradually decreases, the video screen 301 is zoomed out.

[0253] Step 1702: In response to the zooming operation, the electronic device obtains a second zoom ratio of the zoomed video picture relative to the original video picture.

[0254] Step 1703: The electronic device calculates a second critical scaling ratio of the video image.

[0255] In actual use, there is no upper limit to the zooming operation of the video screen 301. In principle, the video screen 301 can be infinitely zoomed in; however, the zooming out operation needs to follow a rule, that is, after the zooming out operation of the video screen 301 is completed and the user's finger leaves the screen, it is necessary to control the cropping frame 401 to be completely within the zoomed video screen 301, that is, the video screen 301 can fill the cropping frame 401.

[0256] After the zooming operation of the video picture 301 is completed, the zoom factor of the video picture 301 when the video picture 301 can just fill the cropping frame 401 is called the second critical zoom ratio.

[0257] In some embodiments, after receiving a zoom operation on the video screen 301, the electronic device may, in response to the zoom operation, calculate a second zoom ratio of the zoomed video screen 301 relative to the original video screen, and a second critical zoom ratio of the video screen; and the electronic device needs to determine the relationship between the second zoom ratio of the current video screen relative to the original video screen and the second critical zoom ratio to determine whether the video screen 301 needs to be enlarged and rebounded.

[0258] When a finger touches the video screen 301, the distance between the two fingers can be calculated as the initial distance, and then the latest distance between the two fingers during the zooming process is calculated, and the ratio of the latest distance to the initial distance is used as the second zoom ratio. In the actual zooming process, the second zoom ratio is continuously calculated.

[0259] The calculation method of the second critical scaling ratio can be divided into the following two cases and calculated separately.

[0260] In the first case, the scene where rulerAngle is equal to 0, that is, the scene where the rotation angle of the video screen 301 is 0° or an integer multiple of 90°. In this case, the electronic device uses the ratio of the target size of the cropping frame 401 to the original size of the video screen 301 as the second critical scaling ratio; wherein the target size of the cropping frame 401 is the height of the cropping frame 401, and the original size of the video screen 301 is the original height of the video screen 301; or, the target size of the cropping frame 401 is the width of the cropping frame 401, and the original size of the video screen 301 is the original width of the video screen 301.

[0261] The original height of the video screen 301 refers to the height of the video screen when the video cropping interface 400 is first displayed; the original width of the video screen 301 refers to the width of the video screen when the video cropping interface 400 is first displayed.

[0262] Specifically, the electronic device may first determine whether the cropping frame 401 is fully extended in width or height. When the aspect ratio of the cropping frame 401 is less than the aspect ratio of the operable area, it is determined that the cropping frame 401 is fully extended in height. When the aspect ratio of the cropping frame 401 is greater than the aspect ratio of the operable area, it is determined that the cropping frame 401 is fully extended in width. The operable area refers to the maximum area of ​​the cropping frame 401 that can respond to the user's gesture operation.

[0263] In the case where the cropping frame 401 is fully extended, the electronic device calculates a first ratio of the height of the cropping frame 401 to the original height of the video screen 301, and then determines whether the product of the original width of the video screen 301 and the first ratio is less than the width of the cropping frame 401. When the product of the original width of the video screen 301 and the first ratio is greater than or equal to the width of the cropping frame 401, the second critical scaling ratio is equal to the first ratio of the height of the cropping frame 401 to the original height of the video screen 301; when the product of the original width of the video screen 301 and the first ratio is less than the width of the cropping frame 401, the second critical scaling ratio is equal to the ratio of the width of the cropping frame 401 to the original width of the video screen 301.

[0264] In the case where the width of the cropping frame 401 is fully stretched, the electronic device calculates the second ratio of the width of the cropping frame 401 to the original width of the video screen 301, and then determines whether the product of the original height of the video screen 301 and the second ratio is less than the height of the cropping frame 401. When the product of the original height of the video screen 301 and the second ratio is greater than or equal to the height of the cropping frame 401, the second critical scaling ratio is equal to the second ratio of the width of the cropping frame 401 to the original width of the video screen 301; when the product of the original height of the video screen 301 and the second ratio is less than the height of the cropping frame 401, the second critical scaling ratio is equal to the height of the cropping frame 401 and the original height of the video screen 301.

[0265] The second case is a scene where rulerAngle is not equal to 0, that is, the rotation angle of the video screen 301 is not 0° and is not an integer multiple of 90°. In this case, the electronic device calculates the critical distance of the video screen 301 based on the width of the cropping frame 401, the height of the cropping frame 401, and the rotation angle of the video screen 301 triggered by the first rotation control (i.e., rulerAngle); the electronic device determines the ratio of the critical distance to the original size of the video screen 301 as the second critical scaling ratio; the original size of the video screen 301 is the original width of the video screen 301 or the original height of the video screen 301.

[0266] Specifically, the second critical zoom ratio may be calculated differently when rulerAngle is not equal to 0 according to the horizontal / vertical state of the video screen 301 and the number of clicks on the second rotation control 403. Exemplarily, when the width of the video screen 301 is greater than or equal to the height of the video screen 301, the initial display state of the video screen 301 is horizontal display; when the width of the video screen 301 is less than the height of the video screen 301, the initial display state of the video screen 301 is vertical state.

[0267] First, when the initial display state of the video screen 301 is horizontal screen display and the number of clicks on the second rotation control 403 is 0 or an even number, the critical distance is equal to the width of the cropping frame 401 × sin(rulerAngle) + the height of the cropping frame 401 × cos(rulerAngle), and the second critical scaling ratio is equal to the ratio of the critical distance to the original height of the video screen 301.

[0268] Second, when the initial display state of the video screen 301 is horizontal screen display and the number of clicks on the second rotation control 403 is an odd number, the critical distance is equal to the height of the cropping frame 401 × sin(rulerAngle) + the width of the cropping frame 401 × cos(rulerAngle), and the second critical scaling ratio is equal to the ratio of the critical distance to the original height of the video screen 301.

[0269] The third type is that when the initial display state of the video screen 301 is vertical screen display and the number of clicks on the second rotation control 403 is 0 or an even number, the critical distance is equal to the height of the cropping frame 401 × sin(rulerAngle) + the width of the cropping frame 401 × cos(rulerAngle), and the second critical scaling ratio is equal to the ratio of the critical distance to the original width of the video screen 301.

[0270] Fourthly, when the initial display state of the video screen 301 is vertical screen display and the second rotation control 403 is clicked an odd number of times, the critical distance is equal to the width of the cropping frame 401 × sin(rulerAngle) + the height of the cropping frame 401 × cos(rulerAngle), and the second critical scaling ratio is equal to the ratio of the critical distance to the original width of the video screen 301.

[0271] like Fig.18As shown, 301d represents the corresponding video screen when the cropping frame 401 is just filled, the C6 vertical point is the vertical point of the boundary line from the C4 vertex of the cropping frame 401 to the P1 vertex-P4 vertex, and the C5 vertical point is the vertical point of the boundary line from the C4 vertex of the cropping frame 401 to the P2 vertex-P3 vertex. The distance between the C4 vertex and the C6 vertical point is equal to the height of the cropping frame 401 × sin (rulerAngle), the distance between the C4 vertex and the C5 vertical point is equal to the width of the cropping frame 401 × cos (rulerAngle), and the distance between the C5 vertical point and the C6 vertical point is also the critical distance. At this time, the second critical scaling ratio is equal to the distance between the C5 vertical point and the C6 vertical point, divided by the original width of the video screen 301.

[0272] Step 1704: The electronic device determines whether the cropping frame is completely located within the scaled video picture according to the second critical scaling ratio and the second scaling ratio.

[0273] In some embodiments, when the second critical zoom ratio is greater than the second zoom ratio, the electronic device determines that there is an area in the cropping frame 401 that is outside the scaled video screen 301; when the second critical zoom ratio is less than or equal to the second zoom ratio, the electronic device determines that the cropping frame 401 is entirely within the scaled video screen 301.

[0274] When the cropping frame 401 is completely within the scaled video screen 301, the electronic device does not enlarge the video screen 301, and the video screen 301 remains unchanged. When there is an area outside the scaled video screen 301 in the cropping frame 401, the electronic device executes the following step 1705.

[0275] Step 1705: when there is an area outside the zoomed video picture in the cropping frame, the electronic device zooms in the zoomed video picture according to the second critical zoom ratio so that the cropping frame is completely within the zoomed video picture.

[0276] In some embodiments, when there is an area in the cropping frame 401 that is outside the scaled video screen 301, in order to make the cropping frame 401 no longer include non-video screens other than the video screen 301, the electronic device may call a second critical scaling ratio to enlarge the scaled video screen 301 so that the cropping frame 401 is entirely within the enlarged video screen 301.

[0277] In other scenarios, after the user scales the video screen 301 and drags the scaled video screen 301, the electronic device needs to update the pivot point of the video screen 301. The pivot point refers to the center point of the video screen 301 when it is rotated or scaled.

[0278] When the scaled video screen 301 is not dragged, the axis point of the video screen 301 is the center point of the video screen 301 by default. The coordinate system of the axis point is to use the upper left corner of the original video screen as the 0 point of the X axis and the 0 point of the Y axis. For example, when the width and height of the original video screen are 100*100, the coordinate value of the original axis point of the original video screen is 50*50. The coordinate value of the axis point cannot exceed the width and height of the video screen.

[0279] When rotating or scaling the video screen 301, the video screen 301 changes with the center point of the video screen 301 as the axis point. During use, after dragging the scaled video screen 301, if the user rotates or scales the video screen again, if the center point of the video screen 301 is still used as the axis point, part of the video screen 301 may appear outside the cropping frame 401.

[0280] Based on this, the embodiment of the present application needs to always use the center point of the cropping frame 401 as the axis point of the video screen 301. After the scaled video screen 301 is dragged, the center point of the video screen 301 deviates from the center point of the cropping frame 401. Therefore, after the scaled video screen 301 is dragged, the electronic device needs to update the axis point of the video screen 301 so that the axis point of the updated video screen 301 is the center point of the cropping frame 401. The electronic device subsequently rotates or scales the video screen 301 based on the updated axis point.

[0281] The calculation of the axis point coordinates always depends on the original width and original height of the video screen 301. For example, for an original video screen of 100*100, the default axis point is (50, 50). At this time, after the original video screen is enlarged twice, the width and height of the video screen become 200*200. After the embodiment of the present application updates the axis point of the video screen 301, the updated axis point coordinates are still (50, 50).

[0282] In some embodiments, the axis point of the video screen 301 can be updated in the following manner: after dragging the scaled video screen 301, the electronic device obtains the sixth vertex coordinates of each vertex of the dragged video screen 301 and the actual scaling ratio of the video screen 301; the electronic device determines the first axis point of the video screen 301 based on the sixth vertex coordinates and the center point of the cropping frame 401; the electronic device determines the second axis point corresponding to the video screen 301 in the video screen 301 after it is reduced at the actual scaling ratio based on the actual position of the first axis point in the dragged video screen 301, and at this time the video screen 301 is reduced with the original axis point as the scaling center point; the electronic device calculates the deviation value between the sixth vertex coordinates and the actual vertex coordinates of the video screen 301 after it is enlarged at the actual scaling ratio, and at this time the video screen 301 is enlarged with the second axis point as the scaling center point; the electronic device updates the coordinates of the video screen 301 based on the deviation value.

[0283] Among them, the electronic device calculates the fifth and sixth lines of the dragged video screen 301 according to the coordinates of the sixth vertex, and the fifth and sixth lines are two adjacent boundary lines in the dragged video screen 301; the electronic device calculates the first axis point distance from the center point of the cropping frame 401 to the fifth line, and the second axis point distance from the center point of the cropping frame 401 to the sixth line; the electronic device divides the first axis point distance by the actual width of the video screen 301, and then multiplies it by the original width of the video screen 301 to obtain the horizontal coordinate of the first axis point; the electronic device divides the second axis point distance by the actual height of the video screen 301, and then multiplies it by the original height of the video screen 301 to obtain the vertical coordinate of the first axis point.

[0284] The actual zoom ratio of the video screen 301 refers to the ratio of the width of the current video screen 301 to the original width of the video screen after the zoomed video screen 301 is dragged, or the ratio of the height of the current video screen 301 to the original height of the video screen.

[0285] like Fig.19 As shown in (a) of FIG. 3 , the vertices of the dragged video screen 301 are respectively P1 vertex, P2 vertex, P3 vertex and P4 vertex. Based on the coordinates of the sixth vertex corresponding to the P1 vertex and the P4 vertex, the fifth line can be calculated, that is, the fifth line is the boundary line of the P1 vertex-P4 vertex; and based on the coordinates of the sixth vertex corresponding to the P1 vertex and the P2 vertex, the sixth line can be calculated, that is, the sixth line is the boundary line of the P1 vertex-P2 vertex.

[0286] The electronic device can calculate the first axis point according to the distance formula from the point to the straight line. Specifically, the first axis point distance from the center point of the cropping frame 401 to the boundary line of the P1 vertex-P4 vertex, and the second axis point distance from the center point of the cropping frame 401 to the boundary line of the P1 vertex-P2 vertex are calculated first. The horizontal coordinate of the first axis point is equal to the first axis point distance divided by the actual width of the video screen 301 and then multiplied by the original width of the video screen 301, and the vertical coordinate of the first axis point is equal to the second axis point distance divided by the actual height of the video screen 301 and then multiplied by the original height of the video screen 301.

[0287] like Fig.19 As shown in (a), the original pivot point of the video screen 301 is pivot1, and the first pivot point calculated by the above method is pivot2. It is a schematic diagram of a video screen with an aspect ratio of 1:1, which is enlarged by 2 times and dragged toward the lower right side, so that the upper left vertex of the video screen 301 coincides with the upper left vertex of the cropping frame 401.

[0288] Then, the electronic device performs a zoom operation on the video screen 301 according to the actual zoom ratio, taking the original axis point of the video screen 301 as the zoom center point. Fig.19 As shown in (b), the actual scaling ratio is 2, and the electronic device uses the original axis point pivot1 as the scaling center point and reduces the width and height of the video screen 301 by 1 / 2.

[0289] Next, the electronic device determines the second pivot point in the zoomed video screen 301 according to the actual position of the first pivot point in the video screen 301 before zooming out. That is, the electronic device can call the setPivotX / Y method of the video screen 301 to update the calculated first pivot point to the zoomed video screen 301.

[0290] For example, Fig.19 As shown in (c), since the calculated first axis point pivot2 is located at 1 / 4 of the video screen 301 before reduction (1 / 4 in both the X-axis direction and the Y-axis direction), the second axis point pivot3 is updated at 1 / 4 of the video screen 301 after reduction.

[0291] After the second axis point is updated, the electronic device zooms in the video image 301 with the second axis point as the zoom center point according to the actual zoom ratio. Fig.19 As shown in (d), the actual zoom ratio is 2, and the electronic device uses the second axis point pivot3 as the zoom center point and enlarges the width and height of the video screen 301 by 2 times.

[0292] Finally, the electronic device calculates the deviation between the sixth vertex coordinate and the actual vertex coordinate of the enlarged video screen 301 , and updates the coordinate of the video screen 301 according to the deviation.

[0293] For example, Fig.19 As shown in (d) in FIG. 1 , the second axis point pivot3 is used as the zoom center point and the video screen 301 is enlarged at the actual zoom ratio. The vertices of the enlarged video screen 301 are relative to Fig.19 There are deviations between the vertices of the video screen 301 shown in (a) in FIG. 1 , and therefore, it is necessary to perform displacement compensation on the deviation of the vertices of the enlarged video screen 301 to accurately adjust the axis point of the video screen 301 .

[0294] Since the upper left vertex of the video screen 301 coincides with the upper left vertex of the cropping frame 401 after the zoomed video screen is dragged, the sixth vertex coordinate of the upper left vertex of the video screen 301 after dragging is also the coordinate of the upper left vertex of the cropping frame 401 (i.e., vertex C1). Fig.19 The coordinates of the video screen 301 are displacement compensated by the deviation value between the actual vertex coordinates of the upper left vertex (i.e., the P1 vertex) of the video screen 301 shown in (d). The second axis point pivot3 of the video screen after displacement compensation is still located at 1 / 4 of the video screen 301 after displacement compensation.

[0295] The above process describes the calculation process of the first critical scaling ratio during the rotation of the video screen 301, the calculation process of the drag boundary when the cropping frame 401 is dragged, the calculation process of the rebound distance after the video screen 301 is dragged, the calculation process of the second critical scaling ratio after the video screen 301 is scaled, and the axis point update process of the video screen 301. The above process can be implemented by a video editing application in an electronic device.

[0296] After calculating the adjustment parameters of the current video screen, such as the first critical zoom ratio, rebound distance, and second critical zoom ratio, the video editing application calls the application framework to record the adjustment parameters of the current video screen. The application framework calls the GPU, so that the GPU initiates the video screen drawing process based on these adjustment parameters, and finally displays the adjusted video screen on the screen of the electronic device.

[0297] Fig. 20 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 20The electronic device 100 shown includes: a memory 101, a processor 110 and a communication interface 102, wherein the memory 101, the processor 110 and the communication interface 102 can communicate; illustratively, the memory 101, the processor 110 and the communication interface 102 can communicate via a communication bus.

[0298] The memory 101 may be a read only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 101 may store a computer program, which is controlled and executed by the processor 110 and communicated by the communication interface 102, thereby implementing the video processing method provided in the above embodiment of the present application.

[0299] The communication interface 102 in the chip may be an input / output interface, a pin or a circuit, etc.

[0300] The electronic device 100 of this embodiment can be used to execute the steps executed in the above method embodiment. Its implementation principles and technical effects are similar and will not be repeated here.

[0301] The present application embodiment also provides a computer-readable storage medium. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.

[0302] In one possible implementation, a computer readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that is intended to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer. Moreover, any connection is appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and optical disk as used herein include optical disk, laser disk, optical disk, digital versatile disk (DVD), floppy disk and Blu-ray disk, where disks usually reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included in the scope of computer readable media.

[0303] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.

[0304] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0305] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above are only specific implementation methods of the present application and are not used to limit the protection scope of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.

Claims

1. A video processing method, characterized in that: include: The electronic device receives a moving operation on a video screen displayed in a video cropping interface; the moving operation includes at least two of a rotation operation, a scaling operation, and a drag operation; the center point of the video screen when it is rotated or scaled is the center point of the cropping frame; When the moving operation includes the rotating operation, the electronic device determines, in response to the rotating operation, whether the cropping frame in the video cropping interface is entirely within the video screen; when there is an area outside the video screen in the cropping frame, the electronic device performs a zoom operation on the video screen during the rotation according to a first critical zoom ratio, so that the cropping frame is entirely within the adjusted video screen; When the moving operation includes the dragging operation, the electronic device determines, in response to the dragging operation, whether all cropping frames in the video cropping interface are located within the video screen; When there is an area outside the video screen in the cropping frame, the electronic device rebounds the dragged video screen according to the rebound distance so that the cropping frame is completely within the adjusted video screen; When the moving operation includes the zooming operation, the electronic device determines, in response to the zooming operation, whether the cropping frame in the video cropping interface is completely located within the video screen; When there is an area outside the video picture in the cropping frame, the electronic device zooms in the scaled video picture according to a second critical zoom ratio so that the cropping frame is entirely within the adjusted video picture; After performing a drag operation on the scaled video screen, the electronic device acquires the sixth vertex coordinates of each vertex of the dragged video screen and an actual scaling ratio of the video screen; The electronic device determines a first axis point of the video screen according to the sixth vertex coordinates and the center point of the cropping frame; The electronic device determines, according to the actual position of the first axis point in the video screen after dragging, a corresponding second axis point in the video screen after the video screen is reduced by the actual zoom ratio; the video screen is reduced with the original axis point as the zoom center point; the original axis point is the center point of the video screen; The electronic device calculates a deviation between the sixth vertex coordinate and the actual vertex coordinate of the video image after being magnified at the actual scaling ratio; the video image is magnified with the second axis point as the scaling center point; The electronic device updates the coordinates of the video screen according to the deviation value.

2. The method according to claim 1, characterized in that When the moving operation includes the rotating operation, the electronic device receives the moving operation on the video screen displayed in the video cropping interface, including: The electronic device receives a touch operation on a first rotation control in the video cropping interface; the first rotation control is used to rotate the video screen according to an angle scale value corresponding to the touch operation when triggered; The electronic device determines, in response to the moving operation, whether all cropping frames in the video cropping interface are located within the video screen, including: The electronic device obtains, in response to the touch operation, first vertex coordinates of each vertex in the video image during the rotation process and second vertex coordinates of each vertex in the cropping frame; The electronic device calculates a first critical scaling ratio of the video image according to the first vertex coordinates and the second vertex coordinates; The electronic device determines whether the cropping frame is completely located within the video picture during the rotation process according to the first critical scaling ratio and a first scaling ratio of the video picture during the rotation process relative to the original video picture.

3. The method according to claim 2, characterized in that The electronic device determines, according to the first critical scaling ratio and a first scaling ratio of the video picture during the rotation relative to the original video picture, whether the cropping frame is entirely within the video picture during the rotation, including: When the first critical scaling ratio is greater than the first scaling ratio, the electronic device determines that there is an area in the cropping frame that is outside the video picture in the rotation process; When the first critical scaling ratio is less than or equal to the first scaling ratio, the electronic device determines that the cropping frame is entirely located within the video picture in the rotating process.

4. The method according to claim 2, characterized in that: The electronic device calculates a first critical scaling ratio of the video picture according to the first vertex coordinates and the second vertex coordinates, including: The electronic device calculates a first connection line formed between every two adjacent vertices in the video picture according to the first vertex coordinates of each vertex in the video picture; The electronic device calculates, according to the second vertex coordinates of each vertex in the cropping frame, a second connecting line formed between the center point of the cropping frame and each vertex in the cropping frame; The electronic device calculates an intersection point formed between the first connecting line corresponding to a first target vertex and the corresponding second connecting line to obtain a target intersection point corresponding to the first target vertex; the first target vertex is any vertex in the cropping frame, the first connecting line corresponding to the first target vertex is the first connecting line in the video screen that is closest to the first target vertex, and the second connecting line corresponding to the first target vertex is the second connecting line formed between the first target vertex and the center point of the cropping frame; The electronic device calculates a first distance between the first target vertex and a center point of the cropping frame, and a second distance between the target intersection point and a center point of the cropping frame; The electronic device calculates a first critical zoom ratio of the video picture according to the first distance and the second distance.

5. The method according to claim 4, characterized in that The electronic device calculates a first critical scaling ratio of the video picture according to the first spacing and the second spacing, including: The electronic device determines the ratio of the first distance to the second distance as a target ratio value corresponding to the first target vertex; The electronic device determines the maximum value of the target ratio values ​​corresponding to the vertices in the cropping frame as the first critical scaling ratio of the video picture.

6. The method according to claim 1, characterized in that When the moving operation includes the dragging operation, the electronic device determines, in response to the moving operation, whether all cropping frames in the video cropping interface are located within the video screen; In response to the dragging operation, the electronic device acquires third vertex coordinates of each vertex in the video image after the dragging and fourth vertex coordinates of each vertex in the cropping frame; The electronic device determines whether the cropping frame is completely located within the dragged video screen according to the third vertex coordinates and the fourth vertex coordinates.

7. The method according to claim 6, characterized in that The electronic device determines, according to the third vertex coordinates and the fourth vertex coordinates, whether the cropping frame is completely located within the dragged video screen, including: When the rotation angle of the video screen is not 0° and not an integer multiple of 90°, the electronic device calculates a third connecting line formed between every two adjacent vertices in the video screen according to the third vertex coordinates of each vertex in the video screen; The electronic device calculates the coordinates of the vertical points from each vertex in the cropping frame to the corresponding third connecting line; The electronic device determines whether the cropping frame is completely located within the video screen after dragging according to the vertical point coordinates and the fourth vertex coordinates.

8. The method according to claim 6, characterized in that Before the electronic device performs a rebound operation on the dragged video screen according to the rebound distance, the method further includes: When the rotation angle of the video screen is not 0° and not an integer multiple of 90°, the electronic device determines, among the vertices in the dragged video screen, a second target vertex that is closest to the center point of the cropping frame; The electronic device acquires the critical coordinates of the critical point corresponding to the second target vertex; the critical point is consistent with the orientation of the second target vertex; The electronic device determines whether the number of vertices in the cropping frame that are outside the video screen after dragging is greater than 1 according to the third vertex coordinates corresponding to the second target vertex, the critical coordinates corresponding to the critical point, the fourth vertex coordinates corresponding to the third target vertex, and the vertical point coordinates corresponding to the two target vertical points; the third target vertex is a vertex in the cropping frame that has the same orientation as the second target vertex, and the target vertical points are two vertices corresponding to the second target vertex in the cropping frame, and vertical points on two boundary lines adjacent to the second target vertex in the video screen; When at least two vertices in the cropping frame are located outside the video screen after dragging, the electronic device uses the deviation distance between the critical point and the second target vertex as the rebound distance.

9. The method according to claim 8, characterized in that After the electronic device determines whether the number of vertices in the cropping frame that are outside the video screen after dragging is greater than 1 according to the third vertex coordinates corresponding to the second target vertex, the critical coordinates corresponding to the critical point, the fourth vertex coordinates corresponding to the third target vertex, and the vertical point coordinates corresponding to the two target vertical points, the method further includes: When a vertex in the cropping frame is outside the video screen after dragging, the electronic device obtains the fourth vertex coordinates corresponding to the fourth target vertex in the cropping frame that is outside the video screen; The electronic device uses the deviation distance between the fourth vertex coordinate corresponding to the fourth target vertex and the vertical point coordinate of the corresponding target vertical point as the rebound distance.

10. The method according to claim 6, characterized in that Before the electronic device performs a rebound operation on the dragged video screen according to the rebound distance, the method further includes: When the rotation angle of the video screen is 0° or an integer multiple of 90°, the electronic device determines, among the vertices in the dragged video screen, a fifth target vertex that is closest to the center point of the cropping frame; The electronic device calculates the rebound distance according to the fourth vertex coordinates corresponding to the vertex in the cropping frame that is consistent with the fifth target vertex orientation and the third vertex coordinates corresponding to the fifth target vertex.

11. The method according to claim 1, characterized in that When the moving operation includes the zooming operation, the electronic device determines, in response to the moving operation, whether all cropping frames in the video cropping interface are located within the video screen, including: In response to the zooming operation, the electronic device acquires a second zoom ratio of the zoomed video picture relative to the original video picture; The electronic device calculates a second critical scaling ratio of the video picture; The electronic device determines whether the cropping frame is entirely located within the scaled video picture according to the second critical scaling ratio and the second scaling ratio.

12. The method according to claim 11, characterized in that The electronic device determines, according to the second critical scaling ratio and the second scaling ratio, whether the cropping frame is entirely located within the scaled video picture, including: When the second critical scaling ratio is greater than the second scaling ratio, the electronic device determines that there is an area in the cropping frame that is outside the scaled video picture; When the second critical scaling ratio is less than or equal to the second scaling ratio, the electronic device determines that the cropping frame is entirely located within the scaled video picture.

13. The method according to claim 11, characterized in that The electronic device calculates a second critical scaling ratio of the video picture, including: When the rotation angle of the video screen is not 0° and not an integer multiple of 90°, the electronic device calculates the critical distance of the video screen according to the width of the cropping frame, the height of the cropping frame, and the rotation angle of the video screen triggered by the first rotation control; The electronic device determines the ratio of the critical distance to the original size of the video screen as the second critical scaling ratio; the original size of the video screen is the original width of the video screen or the original height of the video screen.

14. The method according to claim 11, characterized in that The electronic device calculates a second critical scaling ratio of the video picture, including: When the rotation angle of the video screen is 0° or an integer multiple of 90°, the electronic device uses the ratio of the target size of the cropping frame to the original size of the video screen as the second critical scaling ratio; The target size of the cropping frame is the height of the cropping frame, and the original size of the video screen is the original height of the video screen; or the target size of the cropping frame is the width of the cropping frame, and the original size of the video screen is the original width of the video screen.

15. The method according to claim 1, characterized in that The method further comprises: When the rotation angle of the video screen is not 0° and not an integer multiple of 90°, the electronic device receives a drag operation on the cropping frame; The electronic device acquires the fifth vertex coordinates of each vertex in the video screen in response to the drag operation; The electronic device calculates, according to the fifth vertex coordinates of each vertex in the video picture, a fourth connecting line formed between every two adjacent vertices in the video picture; The electronic device calculates the drag boundary of the cropping frame according to the intersection coordinates corresponding to the intersection formed by the extension lines of the four boundary lines in the cropping frame and the fourth line; the drag boundary is the boundary corresponding to the maximum range allowed for dragging of the cropping frame.

16. The method according to claim 1, characterized in that The electronic device determines the first axis point of the video screen according to the sixth vertex coordinate and the center point of the cropping frame, including: The electronic device calculates a fifth connecting line and a sixth connecting line of the video screen after dragging according to the sixth vertex coordinate; the fifth connecting line and the sixth connecting line are two adjacent boundary lines in the video screen after dragging; The electronic device calculates a distance from a center point of the cropping frame to a first axis point of the fifth line, and a distance from a center point of the cropping frame to a second axis point of the sixth line; The electronic device divides the first axis point distance by the actual width of the video screen, and then multiplies the result by the original width of the video screen to obtain the horizontal coordinate of the first axis point; The electronic device obtains the longitudinal coordinate of the first axis point by dividing the second axis point distance by the actual height of the video screen and then multiplying the result by the original height of the video screen.

17. An electronic device, characterized in that: The device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to call the computer program to execute the video processing method according to any one of claims 1 to 16.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the video processing method according to any one of claims 1 to 16 is implemented.

19. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables a computer to execute the video processing method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • Video processing methods and electronic devices

    CN116095249B

  • Computer-assisted image cropping

    US10101891B1