Image processing method, device, and readable storage medium

The image processing method addresses the challenge of synchronously rotating background content with video content by calculating scaling parameters and extracting a target background frame to fill the canvas area, ensuring seamless rotation and maximum retention of original content.

JP7756177B2Active Publication Date: 2025-10-17BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2023579176
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-07-21
Filing Date
2022-07-20
Publication Date
2025-10-17
Estimated Expiration
2042-07-20

AI Technical Summary

Technical Problem

Existing video editing applications face challenges in synchronously rotating background content with video content without creating blank areas and maximizing retention of original background content.

Method used

An image processing method that involves obtaining a rotation command, calculating scaling parameters based on the rotation angle, and extracting a target background video frame to fill a background canvas area, ensuring vertices on one diagonal line are at the edge and vertices on the other diagonal line are inside the candidate video frame.

Benefits of technology

Ensures seamless rotation of background content with video content, preventing blank areas and maximizing retention of original background content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007756177000023
    Figure 0007756177000023
  • Figure 0007756177000024
    Figure 0007756177000024
  • Figure 0007756177000025
    Figure 0007756177000025
Patent Text Reader

Abstract

The present disclosure relates to an image processing method, an apparatus, and a readable storage medium. The method includes: obtaining a rotation command input by a user for a current video frame, the rotation command including a rotation angle; obtaining a scaling parameter according to the rotation angle; performing a scaling process on an original background video frame corresponding to the current video frame according to the scaling parameter to obtain a candidate video frame; extracting a target background video frame from the candidate video frame, and filling a background canvas area with the target background video frame. In this method, two first vertices on one diagonal of the extracted target background video frame are located at the edge of the candidate video frame, and two first vertices on the other diagonal are located inside the candidate video frame.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] [Cross-Citation of Related Applications] This application claims priority to a Chinese patent application filed on July 21, 2021, entitled "Image Processing Method, Apparatus, and Readable Storage Medium" and bearing application number 202110824605.2, the disclosure of which is incorporated herein by reference in its entirety.

[0002] [Technical field] The present disclosure relates to the field of image processing technology, and more particularly to an image processing method, apparatus, and readable storage medium. [Background technology]

[0003] With the development of Internet technology, the way of creating videos is also changing. Nowadays, users generally select an application (APP) to create videos. When creating videos, users can use the background function provided by the APP to add background effects to the video. Here, the procedure for adding background effects to video content using the background function of the APP is as follows: First, background content is determined, and then an appropriate effect processing, such as blurring, is performed on the background content. Then, the background content after the effect processing is superimposed on the video content. Summary of the Invention

[0004] The present disclosure provides an image processing method, apparatus, and readable storage medium.

[0005] According to a first aspect, the present disclosure provides a method for generating a rotation command for a current video frame, the rotation command including a rotation angle input by a user; obtaining a scaling parameter based on the rotation angle for performing a scaling process on an original background video frame corresponding to the current video frame to obtain a candidate video frame; and cutting out a target background video frame from the candidate video frame and filling a background canvas area with the cut-out target background video frame, wherein two first vertices on one diagonal line in the target background video frame are located at an edge of the candidate video frame and two first vertices on the other diagonal line are located inside the candidate video frame.

[0006] In some possible designs, the aforementioned segmentation of the target background video frame from the candidate video frame may include: obtaining a position in the candidate video frame of each of the first vertices of the target background video frame based on the rotation angle; and extracting the target background video frame from the candidate video frame based on a position in the candidate video frame of each of the first vertices.

[0007] In some possible designs, obtaining a position in the candidate video frame of each of the first vertices of the target background video frame based on the rotation angle as described above may include: performing a remainder calculation on the rotation angle to obtain a remainder; obtaining coordinates in a two-dimensional Cartesian coordinate system of each of the first vertices based on the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, and a relationship between a first variable and a second variable; Wherein, the two-dimensional Cartesian coordinate system is established based on the candidate video frame, the first variable is related to the length of the candidate video frame, and the second variable is related to the width of the candidate video frame.

[0008] In some possible designs, when the rotation angle is greater than 90 degrees and less than 360 degrees, obtaining coordinates in a two-dimensional Cartesian coordinate system of each of the first vertices based on the relationship among the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, a first variable, and a second variable as described above includes: obtaining coordinates of a plurality of second vertices in the two-dimensional Cartesian coordinate system based on the relationship between the remainder, the length and width of the background canvas region, the length and width of the candidate video frame, a first variable, and a second variable; and performing coordinate mapping on each of the second vertices based on the rotation angle to obtain coordinates of each of the first vertices in the two-dimensional Cartesian coordinate system.

[0009] In some possible designs, when the rotation angle is less than 90 degrees, obtaining the coordinates of each of the first vertices in a two-dimensional Cartesian coordinate system based on the relationships among the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, a first variable, and a second variable includes calculating the coordinates of each of the first vertices in the two-dimensional Cartesian coordinate system according to the following formula:

number

number

[0010] In some possible designs, the previously mentioned method of obtaining the scaling parameters based on the rotation angle is as follows: performing a remainder calculation on the rotation angle to obtain a remainder; obtaining a length of the candidate video frame based on a relationship between the remainder and each of the length and width of the background canvas and a first variable; obtaining a width of the candidate video frame based on a relationship between the remainder and each of the length and width of the background canvas and a second variable; The first variable is related to a length of the candidate video frame, the second variable is related to a width of the candidate video frame, and the scaling parameters include the length and width of the candidate video frame.

[0011] In some possible designs, the value of the first variable is 0 if the width of the candidate video frame is greater than the length of the candidate video frame, and the value of the second variable is 0 if the length of the candidate video frame is greater than the width of the candidate video frame.

[0012] According to a second aspect, the present disclosure provides a method for manufacturing a semiconductor device, comprising: an acquisition module for acquiring a rotation command input by a user for a current video frame, the rotation command including a rotation angle; a first processing module for obtaining a scaling parameter based on the rotation angle, and performing a scaling process on an original background video frame corresponding to the current video frame based on the scaling parameter to obtain a candidate video frame; and a second processing module for cutting out a target background video frame from the candidate video frame and filling a background canvas area with the cut-out target background video frame, wherein two first vertices on one diagonal line in the target background video frame are located at the edge of the candidate video frame, and two first vertices on the other diagonal line are located inside the candidate video frame.

[0013] According to a third aspect, the present disclosure provides an electronic device including a memory and a processor, the memory is configured to store the computer program instructions; The processor provides an electronic device arranged to execute the computer program instructions to implement the image processing method according to any one of the first aspects.

[0014] According to a fourth aspect, an embodiment of the present disclosure provides a non-transitory readable storage medium containing computer program instructions, the non-transitory readable storage medium comprising: There is further provided a readable storage medium, the computer program instructions of which, when executed by a processor of an electronic device, cause the processor to implement the image processing method of any one of the first aspects.

[0015] According to a fifth aspect, an embodiment of the present disclosure further provides a computer program product having stored thereon a computer program that, when executed by a processor of an electronic device, causes the processor to implement the image processing method described in any one of the first aspects.

[0016] According to a sixth aspect, an embodiment of the present disclosure further provides a computer program that, when executed by a processor of an electronic device, causes the processor to implement the image processing method according to any one of the first aspects. [Brief explanation of the drawings]

[0017] The drawings herein, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.

[0018] In order to more clearly describe the technical solutions in the embodiments or related art of the present disclosure, the following briefly describes the drawings that need to be used in the description of the embodiments or related art. Obviously, those skilled in the art can obtain other drawings based on these drawings without any creative efforts. [Figure 1] 1 is a flowchart of an image processing method according to an embodiment of the present disclosure. [Figure 2a] 3 is a schematic diagram of the positional relationship between each first vertex of a target background video frame and a candidate video frame according to the present disclosure; FIG. [Figure 2b] 3 is a schematic diagram of the positional relationship between each first vertex of a target background video frame and a candidate video frame according to the present disclosure; FIG. [Figure 3] 1 is a schematic diagram illustrating the configuration of an image processing device according to an embodiment of the present disclosure. [Figure 4] FIG. 1 is a schematic diagram illustrating the configuration of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE INVENTION

[0019] In order to make the above-mentioned objects, features and advantages of the present disclosure more clearly understandable, the present disclosure will be further described below. It should be noted that, unless contradictory, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

[0020] In the following description, many specific details are set forth to provide a thorough understanding of the present disclosure; however, the present disclosure may be embodied in other forms different from those described herein. Obviously, the embodiments in the specification are only some of the embodiments of the present disclosure, but not all of the embodiments.

[0021] Currently, APPs support users to rotate video content at any angle, and the background content needs to be rotated synchronously with the video content. When the background content is rotated synchronously with the video content, how to avoid blank areas in the area where the background content is displayed and retain as much of the original background content as possible is an issue that needs to be resolved quickly.

[0022] Embodiments of the present disclosure provide an image processing method, apparatus, electronic device, readable storage medium, and program product, which include: obtaining a rotation command input by a user, the rotation command including a rotation angle relative to a current video frame; obtaining a scaling parameter according to the rotation angle; performing a scaling process on an original background video frame corresponding to the current video frame based on the scaling parameter to obtain a candidate video frame; extracting a target background video frame from the candidate video frame; and filling a background canvas area with the target background video frame. When extracting the target background video frame, two first vertices on one diagonal of the target background video frame are located at the edge of the candidate video frame, and two first vertices on the other diagonal are located within the candidate video frame, thereby ensuring that the background canvas area is filled when the video content and the background content are rotated synchronously, and achieving maximum retention of the image content of the original background video frame.

[0023] The image processing method according to the present disclosure can be performed by an image processing device, which can be implemented in any software and / or hardware manner. For example, the image processing device can be, but is not limited to, a tablet, a mobile phone (e.g., a flip phone, a large-screen phone, etc.), a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a smart TV, a smart screen, a high-definition TV, a 4K TV, a smart speaker, a smart projector, etc. The present disclosure does not limit the specific type of the image processing device.

[0024] Here, the present disclosure does not limit the type of operating system of the electronic device, such as Android system, Linux system, Windows system, iOS system, etc.

[0025] 1 is a flowchart of an image processing method according to an embodiment of the present disclosure. This embodiment will be described using an example in which an electronic device executes the image processing method. As shown in FIG. 1, the method of this embodiment includes the following steps:

[0026] S101: Obtain a rotation command including a rotation angle for the current video frame input by the user.

[0027] Here, the current video frame may be obtained by performing a rotation process on the original video frame being edited, or the current video frame may be the original video frame, which is determined from the captured image material and is not rotated.

[0028] In this solution, the scaling parameters corresponding to the original background video frame are related to the rotation angle corresponding to the current video frame, or can be understood as being calculated from the rotation angle corresponding to the current video frame, so it is necessary to obtain the rotation angle indicated by the rotation command for the current video frame.

[0029] In one possible implementation, the electronic device receives a rotation command input by a user, the rotation command instructing the electronic device to perform a rotation process on an original video frame to obtain a current video frame, where the rotation command may include a rotation angle and a rotation direction.

[0030] Alternatively, the rotation command may be input by the user by operating a touch screen of the electronic device, but is not limited to this.

[0031] For example, a user may swipe any two fingers simultaneously on a touchscreen to generate a rotation trajectory. The electronic device can analyze the rotation trajectory to obtain the rotation angle and direction. For example, a user may rotate the touchscreen of a mobile phone simultaneously with their thumb and index finger (or other methods are also possible), thereby generating a first rotation trajectory corresponding to the thumb and a second rotation trajectory corresponding to the index finger. The first rotation trajectory and the second rotation trajectory are analyzed to obtain the rotation direction and angle.

[0032] For example, the rotation command may be input by a user operating a corresponding control for realizing a rotation function provided on a user interface displayed on the electronic device. For example, the corresponding control for realizing the rotation function may be a rotation angle axis. When the user drags a button on the rotation angle axis, the rotation angle can be increased or decreased, thereby inputting a rotation command to the electronic device.

[0033] This disclosure does not limit the implementation in which a user inputs a rotation command into an electronic device.

[0034] S102: According to the rotation angle, obtain a scaling parameter for performing a scaling process on the original background video frame corresponding to the current video frame to obtain a candidate video frame.

[0035] Here, the original background video frame may have image content determined from preset image material added by a user. Here, the preset image material may include, for example, a photo already taken by an electronic device or an image already downloaded. Alternatively, the original background video frame may be obtained by processing the current video frame. The present disclosure does not limit parameters such as image content, image resolution, etc. of the original background video frame.

[0036] In this embodiment, the scaling parameters may include the length and width of the candidate video frame, and the aspect ratio of the candidate video frame may be the same as the aspect ratio of the original background video frame.

[0037] In one possible implementation, the electronic device may obtain a length of the candidate video frame based on a relationship between the rotation angle and each of the length and width of the background canvas and a first variable. The electronic device may obtain a width of the candidate video frame based on a relationship between the rotation angle and each of the length and width of the background canvas and a second variable.

[0038] The first variable is a variable related to the length of the candidate video frame, and the second variable is a variable related to the width of the candidate video frame.

[0039] Here, the relationship between the rotation angle and each of the length and width of the background canvas includes an angle relationship, for example, a sine or cosine relationship.

[0040] Here, the relationship between the rotation angle and the length and width of the background canvas, the first variable, the second variable, and the interrelationship between these parameters and the length and width of the candidate video frame can be referred to in the detailed description of the embodiment shown in Figures 2a and 2b below.

[0041] After obtaining the scaling parameters, a scaling process may be performed on the original background video frame based on the scaling parameters, centered on the geometric center point of the original background video frame, to obtain candidate video frames.

[0042] S103: A target background video frame is extracted from the candidate video frame, and a background canvas area is filled with the extracted target background video frame, where two first vertices on one diagonal line of the target background video frame are located at an edge of the candidate video frame, and two first vertices on the other diagonal line of the target background video frame are located inside the candidate video frame.

[0043] Here, the background canvas area is an area for displaying background content. Video content is usually displayed on top of the background canvas area, and the size of the background canvas area may be larger than the size of the video content. The aspect ratio of the background canvas area may be the same as the aspect ratio of the original background video frame. In some cases, the length and width of the background canvas area may be equal to the length and width of the original background video frame, respectively. The size of the background canvas area may be the same as the size of the target background video frame. That is, the length and width of the background canvas area may be equal to the length and width of the target background video frame, respectively.

[0044] To ensure that there are no blank areas in the background canvas area, the method ensures that the first vertices of each target background video frame overlap with the candidate video frame, so that the cut-out target background video frame can completely fill the background canvas area.Furthermore, the method ensures that the first vertices of two diagonal lines in the target background video frame overlap with the edges of the candidate video frame, so as to maximize the retention of the image content of the original background video frame.

[0045] In one possible implementation, the electronic device may calculate and determine a position of each first vertex in the candidate video frame based on an edge angle relationship between one or more parameters among the rotation angle, the length and width of the background canvas region, the length and width of the candidate video frame, the first variable, and the second variable, and determine a region of the target background video frame to be cut out from the candidate video frame based on the position of each first vertex in the target background video frame. Texture data of the region of the target background video frame is extracted, and the background canvas region is filled with the extracted texture data.

[0046] Here, the relationship between the rotation angle, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, the second variable, and each of these parameters and each first vertex can be referred to in the detailed description of the embodiment shown in Figures 2a and 2b described below.

[0047] In this embodiment, a rotation command input by a user for a current video frame, including a rotation angle, is obtained, and a scaling parameter is obtained according to the rotation angle. A scaling process is performed on an original background video frame corresponding to the current video frame based on the scaling parameter to obtain a candidate video frame. A target background video frame is extracted from the candidate video frame, and the background canvas area is filled with the target background video frame. When extracting the target background video frame, the two first vertices on one diagonal of the target background video frame are located at the edge of the candidate video frame, and the two first vertices on the other diagonal are located inside the candidate video frame, thereby ensuring that the background canvas area is filled when the video content rotates and the background content rotates synchronously, and achieving maximum retention of the image content of the original background video frame.

[0048] Based on the embodiment shown in FIG. 1, the image processing method according to the embodiment of the present disclosure will now be described in detail, taking as an example a case where the background canvas area is a rectangular parallelogram.

[0049] It should be noted that if the background canvas area is a rectangular parallelogram, the target background video frame may also be a rectangular parallelogram of the same size as the background canvas area.

[0050] For example, if the background canvas region is a rectangular region and the pixel size of the background canvas region is 1500×10 15 , then the target background video frame to be cropped is also rectangular and the pixel size is 1500×10 15 .

[0051] Hereinafter, with reference to the embodiment shown in FIG. 2a and FIG. 2b and steps a to d, an exemplary description will be given of how to determine the position of each first vertex of the target background video frame in the candidate video.

[0052] Step a: Obtain a rotation command input by the user, and calculate a rotation angle α based on the rotation command.’ Get.

[0053] Here, the rotation command may be obtained in the manner shown in the embodiment of Figure 1, but of course it may also be obtained in other manners, which will not be further described here for the sake of brevity.

[0054] Step b: Rotation angle α ’ A remainder α is obtained by performing a remainder calculation on , and the scaling parameter is calculated using equation (1).

[0055] Specifically, first, the rotation angle α ’ The first remainder operation is performed on ” In the first remainder calculation, the divisor is 360 degrees. Next, the remainder α ” The second remainder calculation is performed on , to obtain the remainder α. In the second remainder calculation, the divisor is 90 degrees.

[0056] Since the rotation changes periodically by 360 degrees, for example, rotating the original video frame by 360 degrees is equivalent to rotating the original video frame by 0 degrees. Therefore, in this solution, first, a first remainder calculation is performed using 360 degrees as the divisor.

[0057] In this method, the second remainder calculation is then performed using 90 degrees as the divisor, and the value of the remainder α is set in the range of [0, 90]. By substituting the value of the remainder α into the subsequent equations (1) and (2) to perform sine and cosine calculations, accurate calculation results can be obtained in both cases.

[0058] Here, equation (1) is as follows:

number

number

[0059] It should be noted that the value of k may be determined based on the aspect ratio of the original background video frame. For example,

number

[0060] Optionally, of the candidate video frames length V w ’ is the candidate video frame width V h ’ If the difference is greater than , then Δh=0. width V h ’ is the candidate video frame length V w ’ If it is greater than , Δw=0.

[0061] As can be seen from the above description, the candidate video frame in this method is obtained by proportionally scaling the original background video frame, so if the length of the original background video frame is greater than the width, the length of the candidate video frame will be greater than the width, and if the length of the original background video frame is less than the width, the length of the candidate video frame will be less than the width.

[0062] It should be noted that in this solution, for the candidate video frames, the lengths all refer to the vertical edges, and the widths all refer to the horizontal edges.

[0063] Step c: According to the scaling parameters, perform scaling on the original background video frame to obtain a candidate video frame.

[0064] Step d: Based on the relationship between the remainder α, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, and the second variable, obtain the coordinates of each first vertex in the XOY Cartesian coordinate system, wherein the XOY Cartesian coordinate system is established from the candidate video frame.

[0065] Here, the XOY Cartesian coordinate system is a two-dimensional Cartesian coordinate system established by two sides, the length and width, of the candidate video frame.

[0066] For example, if the rotation angle is 0 degrees, 360 degrees, or an integer multiple of 360 degrees, it corresponds to no rotation occurring, and as shown in Figure 2a, the four vertices of the candidate video frame are a1, a2, a3, and a4, respectively, and the horizontal coordinate axis (X axis) of the XOY Cartesian coordinate system may be determined based on the width side of the candidate video frame, and the vertical coordinate axis (Y axis) of the XOY Cartesian coordinate system may be determined based on the long side of the candidate video frame.

[0067] Specifically, as shown in Figure 2a, the origin of the XOY Cartesian coordinate system is the vertex a1 of the candidate video frame, the positive direction of the X axis is horizontally rightward, i.e., along the direction from a1 to a2, and the positive direction of the Y axis is vertically downward, i.e., along the direction from a1 to a3.

[0068] What is needed to be explained is not limited to the two-dimensional Cartesian coordinate system established by two mutually perpendicular long and wide sides shown in Figures 2a and 2b. For example, the two-dimensional Cartesian coordinate system may be established by using the side from a3 to a4 and the side from a3 to a1.

[0069] Continuing to refer to Figure 2a, based on the XOY Cartesian coordinate system shown in Figure 2a, the remainder α, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, the second variable, and the side angle relationships between these parameters and each first vertex directly or indirectly satisfy Equation (2).

[0070] Illustratively, equation (2) is as follows:

number

[0071] In equation (2),

number

number

number

number

number

number

number

number

[0072] It should be noted that in this method, the calculated coordinates of vertices p1 to p4 are normalized, and the coordinates of vertices a1, a2, a3, and a4 in the candidate video frame in the XOY Cartesian coordinate system can be written as a1=(0,0), a2=(1,0), a3=(0,1), and a4=(1,1), respectively.

[0073] In practical applications, the coordinates of the vertices a1, a2, a3, and a4 in the XOY Cartesian coordinate system and the coordinates of the vertices p1 to p4 in the candidate video frame do not need to be normalized.

[0074] Let us assume that the four first vertices corresponding to the target background video frame are denoted as r1, r2, r3, and r4, respectively.

[0075] Referring to FIG. 2b, FIG. 2b shows that when the rotation angle is 0°<α ’ When the angle is <90°, the positional relationship between the four first vertices of the target background video frame and the candidate video frame is exemplarily shown.

[0076] As shown in Figures 2a and 2b, when the rotation angle is 0°≦α ’ If ≦90°, each first vertex of the target background video frame directly satisfies equation (2), that is, the above vertices p1 to p4 correspond to the corresponding four first vertices of the target background video frame, that is, r1=p1, r2=p2, r3=p3, r4=p4.

[0077] Rotation angle is 90°<α ’< 360°, each first vertex of the target background video frame indirectly satisfies Equation (2). Specifically, when the rotation angle is 90°<α ’ If the angle is less than 360°, vertices p1 to p4 are obtained by calculation using equation (2), and then coordinate mapping is performed on each of the vertices p1 to p4 in the XOY Cartesian coordinate system, thereby obtaining the positions of the four first vertices in the candidate video frame corresponding to the target background video frame.

[0078] If vertices p1 to p4 are expressed as a 2x2 matrix, it is as shown in equation (3).

number

[0079] Specifically, when the rotation angle is 90°<α ’ <360°, if the rotation angle is 90°<α ’ ≦180°, 180°<α ’ ≦270°, 270°<α ’ <360°. We will now explain in detail how coordinate mapping is performed on vertices p1 to p4 to determine the position of each first vertex.

[0080] (a): Rotation angle is 90°<α ’ If the angle is ≦180°, coordinate mapping is performed on each of vertices p1 to p4. The obtained result may be expressed by equation (4).

number

[0081] (b): Rotation angle is 180°<α ’If the angle is ≦270°, coordinate mapping is performed on each of vertices p1 to p4. The obtained result may be expressed by equation (5).

number

[0082] (c): Rotation angle is 270°<α ’ If the angle is less than 360°, coordinate mapping is performed on each of vertices p1 to p4. The obtained result may be expressed by equation (6).

number

[0083] In this method, by combining the above three cases with equations (4) to (6), performing coordinate mapping for each of vertices p1 to p4 is equivalent to performing a rotational transformation on the matrix expressed by equation (3).

[0084] The method according to this embodiment obtains the position of each first vertex in the candidate video frame through coordinate calculation, which in practical application consumes less resources due to calculation using formulas, and can effectively improve image processing efficiency.

[0085] After obtaining the positions of each of the first vertices in the candidate video frame by the method shown in steps a to d above, texture data in the corresponding area may be extracted, and the background canvas area may be filled with the extracted texture data.

[0086] In practical applications, due to the continuity of each video frame in the video, when the user continuously rotates the original video content, the above process is performed accordingly for each video frame, thereby ensuring that the background content corresponding to each video frame in the video rotates synchronously according to the video content, and ensuring that the background canvas area is filled, while maximally preserving the image content of the original background video frame.

[0087] Illustratively, the present disclosure further provides an image processing device.

[0088] 3 is a schematic diagram illustrating the configuration of an image processing device according to an embodiment of the present disclosure. As shown in FIG. 3, an image processing device 300 according to this embodiment includes: an acquisition module 301 for acquiring a rotation command input by a user for a current video frame, the rotation command including a rotation angle; a first processing module 302 for obtaining a scaling parameter according to the rotation angle, and performing a scaling process on an original background video frame corresponding to the current video frame according to the scaling parameter to obtain a candidate video frame; and a second processing module 303 for cutting out a target background video frame from the candidate video frame and filling the background canvas area with the cut-out target background video frame, wherein two first vertices on one diagonal in the target background video frame are located at the edge of the candidate video frame, and two first vertices on the other diagonal are located inside the candidate video frame.

[0089] In some possible designs, the second processing module 303 is specifically used for obtaining the position of each first vertex of the target background video frame in each candidate video frame based on the above rotation angle, and for cutting out the target background video frame from the candidate video frame based on the position of each first vertex in each candidate video frame.

[0090] In some possible designs, the second processing module 303 is specifically used for performing a subtraction operation on the rotation angle to obtain a remainder, and obtaining coordinates of each first vertex in a two-dimensional Cartesian coordinate system based on the relationship between the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, and the first variable and the second variable, wherein the two-dimensional Cartesian coordinate system is established based on the candidate video frame.

[0091] Wherein, the first variable is related to the length of the candidate video frame, and the second variable is related to the width of the candidate video frame.

[0092] In some possible designs, when the rotation angle is greater than 90 degrees and less than 360 degrees, the second processing module 303 is specifically used to obtain coordinates of multiple second vertices in the two-dimensional Cartesian coordinate system based on the relationship between the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, a first variable, and a second variable, and to perform coordinate mapping for each of the second vertices based on the rotation angle to obtain coordinates of each of the first vertices in the two-dimensional Cartesian coordinate system.

[0093] In some possible designs, when the rotation angle is less than 90 degrees, the second processing module 303 is specifically used to calculate the coordinates of each of the first vertices in the two-dimensional Cartesian coordinate system according to the following formula:

number

number

[0094] In some possible designs, the first processing module 302 is specifically used to perform a subtraction operation on the rotation angle to obtain a remainder, obtain a length of the candidate video frame based on a relationship between the remainder and the length and width of the background canvas area, respectively, and a first variable, and obtain a width of the candidate video frame based on a relationship between the remainder and the length and width of the background canvas area, respectively, and a second variable.

[0095] Wherein, the first variable is related to the length of the candidate video frame, the second variable is related to the width of the candidate video frame, and the scaling parameters include the length and width of the candidate video frame.

[0096] In some possible designs, the value of the first variable is 0 if the width of the candidate video frame is greater than the length of the candidate video frame, and the value of the second variable is 0 if the length of the candidate video frame is greater than the width of the candidate video frame.

[0097] The image processing device according to this embodiment can be used to implement the technical solution shown in any one of the above method embodiments, and since the implementation principles and technical effects are similar, please refer to the description of the above method embodiment and no further description will be given here.

[0098] 4 is a schematic diagram illustrating the configuration of an electronic device according to an embodiment of the present disclosure. As shown in FIG. 4, an electronic device 400 according to this embodiment includes a memory 401 and a processor 402.

[0099] Here, the memory 401 may be an independent physical means, and may be connected to the processor 402 via a bus 403. The memory 401 and the processor 402 may be integrated together and realized by hardware or the like.

[0100] The memory 401 is used to store program instructions, which the processor 402 calls to perform the operations of any one of the method embodiments described above.

[0101] Alternatively, when a part or all of the methods of the above-described embodiments are implemented in software, the above-described electronic device 400 may include only the processor 402. A memory 401 for storing a program is located outside the electronic device 400, and the processor 402 is connected to the memory via circuits / wiring to read and execute the program stored in the memory.

[0102] The processor 402 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP.

[0103] The processor 402 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0104] The memory 401 may include volatile memory, such as random-access memory (RAM). The memory may also include non-volatile memory, such as flash memory, a hard disk drive (HDD), or a solid-state drive (SSD). The memory may also include a combination of the above types of memory.

[0105] The present disclosure further provides a non-transitory computer-readable storage medium (also referred to as a readable storage medium) including computer program instructions that, when executed by at least one processor of an electronic device, cause the at least one processor to perform the technical solution of any one of the above method embodiments.

[0106] The present disclosure further provides a program product, the program product including a computer program, the computer program being stored in a readable storage medium, at least one processor of the electronic device being capable of reading the computer program from the readable storage medium, and the at least one processor executing the computer program to cause the electronic device to implement the technical solution of any one of the above method embodiments.

[0107] It should be understood that, in this specification, relational terms such as "first" and "second" are used solely to distinguish one entity or operation from another and do not necessarily require or imply the existence of any actual relationship or order between those entities or operations. Furthermore, the terms "comprise," "include," or any other variant thereof indicate a non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements but also other elements not expressly specified or inherent in such process, method, article, or device. Absent further limitations, an element qualified by "comprises a..." does not exclude the process, method, article, or device that includes said element from also including other identical elements.

[0108] The foregoing are merely specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to these embodiments, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. Obtaining a user input rotation command for a current video frame, the rotation command including a rotation angle; Obtaining a scaling parameter based on the rotation angle, and using the scaling parameter to perform a scaling process on the original background video frame corresponding to the current video frame around a geometric center point of the original background video frame to obtain a candidate video frame, wherein the aspect ratio of the candidate video frame obtained by the scaling process is the same as that of the original background video frame, and the scaling parameter includes a length and a width of the candidate video frame, wherein the scaling process is performed so that two first vertices on one diagonal of the rotated background canvas area are located at an edge of the candidate video frame, and two first vertices on the other diagonal are located inside the candidate video frame, and wherein the rotation of the background canvas area includes rotating the background canvas area from an initial position around the geometric center point of the background canvas area by the rotation angle, and at the initial position, the background canvas area and the original background video frame overlap; and extracting content within the rotated background canvas area in the candidate video frame as a target background video frame; Wherein, the enlargement process is: performing a remainder calculation on the rotation angle to obtain a remainder, wherein the remainder calculation includes a first remainder calculation with a divisor of 360 degrees and a second remainder calculation with a divisor of 90 degrees; obtaining a position in the candidate video frame of each first vertex based on the remainder, a length and a width of the background canvas area, a length and a width of the candidate video frame, and a relationship between the first variable and a second variable; Wherein the first variable is related to the length of the candidate video frame, and the second variable is related to the width of the candidate video frame; and When the rotation angle is greater than 90 degrees and less than 360 degrees, obtaining a position of each of the first vertices in the candidate video frame based on the relationship among the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, and the second variable as described above includes: obtaining positions of a plurality of second vertices in the candidate video frame based on the relationship between the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, and the second variable; and performing coordinate mapping for each of the second vertices based on the rotation angle to obtain a position in the candidate video frame of each of the first vertices.

2. The above-mentioned obtaining a position of each first vertex in the candidate video frame based on the relationship between the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, and the second variable includes: obtaining coordinates in a two-dimensional Cartesian coordinate system of each of the first vertices based on the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, and a relationship between the first variable and the second variable; The method of claim 1 , wherein the two-dimensional Cartesian coordinate system is established based on the candidate video frames.

3. When the rotation angle is less than or equal to 90 degrees, obtaining the coordinates of each of the first vertices in the two-dimensional Cartesian coordinate system based on the relationship among the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, and the second variable includes calculating the coordinates of each of the first vertices in the two-dimensional Cartesian coordinate system according to the following formula: [Equation 1] Among them, C w represents the length of the background canvas area, and C h represents the width of the background canvas area, α represents the remainder, and V w ' denotes the length of the candidate video frame, and V h ' represents the width of the candidate video frame, Δw represents the first variable, Δh represents the second variable, And among them, [Equation 2] 3. The method of claim 2, wherein each of the first vertices represents a coordinate in a two-dimensional Cartesian coordinate system.

4. The aforementioned method of obtaining a scaling parameter based on the rotation angle includes: obtaining a length of the candidate video frame based on a relationship between the remainder and each of the length and width of the background canvas area and the first variable; and obtaining a width of the candidate video frame based on a relationship between the remainder and a length and a width of the background canvas area, respectively, and the second variable.

5. 2. The method of claim 1, wherein the value of the first variable is 0 if the width of the candidate video frame is greater than the length of the candidate video frame, and the value of the second variable is 0 if the length of the candidate video frame is greater than the width of the candidate video frame.

6. an acquisition module for acquiring a rotation command input by a user for a current video frame, the rotation command including a rotation angle; a first processing module for obtaining a scaling parameter based on the rotation angle, and using the scaling parameter to perform a scaling process on the original background video frame corresponding to the current video frame around a geometric center point of the original background video frame to obtain a candidate video frame, wherein the aspect ratio of the candidate video frame obtained by the scaling process is the same as that of the original background video frame, and the scaling parameter includes a length and a width of the candidate video frame, wherein the scaling process is performed so that two first vertices on one diagonal of the rotated background canvas area are located at an edge of the candidate video frame, and two first vertices on the other diagonal are located inside the candidate video frame, and wherein the rotation of the background canvas area includes rotating the background canvas area from an initial position around the geometric center point of the background canvas area by the rotation angle, and at the initial position, the background canvas area and the original background video frame overlap; a second processing module for extracting content within the rotated background canvas area in the candidate video frame as a target background video frame; Wherein, the enlargement process is: performing a remainder calculation on the rotation angle to obtain a remainder, wherein the remainder calculation includes a first remainder calculation with a divisor of 360 degrees and a second remainder calculation with a divisor of 90 degrees; obtaining a position in the candidate video frame of each first vertex based on the remainder, a length and a width of the background canvas area, a length and a width of the candidate video frame, and a relationship between the first variable and a second variable; Wherein the first variable is related to the length of the candidate video frame, and the second variable is related to the width of the candidate video frame; and When the rotation angle is greater than 90 degrees and less than 360 degrees, obtaining a position of each of the first vertices in the candidate video frame based on the relationship among the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, and the second variable as described above includes: obtaining positions of a plurality of second vertices in the candidate video frame based on the relationship between the remainder, the length and width of the background canvas area, the length and width of the candidate video frame, the first variable, and the second variable; and performing coordinate mapping for each of the second vertices based on the rotation angle to obtain a position of each of the first vertices in the candidate video frame.

7. An electronic device including a memory and a processor, the memory is configured to store computer program instructions; An electronic device, wherein the processor is arranged to execute the computer program instructions to implement the image processing method of any one of claims 1 to 5.

8. A non-transitory readable storage medium containing computer program instructions, comprising: A readable storage medium, the computer program instructions, when executed by at least one processor of an electronic device, causing the at least one processor to implement the image processing method of any one of claims 1 to 5.

9. A computer program product which, when executed by at least one processor of an electronic device, causes the at least one processor to implement the image processing method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method, apparatus and terminal synthesizing visual images

    CN101309389A

  • Digital camera

    JP2006245726A

  • Tilt correction of electronic images

    US7305146B2

  • Rotation stabilization

    WO2014031830A1