Special effect video generation method and device, electronic equipment and storage medium
By dynamically constructing multiple planes in three-dimensional space and displaying special effects, the limitations of adding special effects in existing technologies are solved, enabling more flexible and diverse special effects video generation and improving the user experience.
Patent Information
- Application Number
- CN202210494748.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-07
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-05-07
AI Technical Summary
In existing technologies, video shooting applications can only load special effects on a single plane, which cannot meet the diverse needs of users, and the operation of adding special effects is limited.
By performing plane estimation on point cloud data in three-dimensional space based on a random sampling consensus algorithm, multiple planes are dynamically constructed, and target effects are displayed on these planes to generate target effect video frames.
It enhances the flexibility of adding special effects and improves the user experience, meeting diverse user needs and increasing the flexibility of special effects video generation and personalized special effects addition.
Smart Images

Figure CN117061684B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to a method, apparatus, electronic device, and storage medium for generating special effects videos. Background Technology
[0002] With the continuous development of internet technology, more and more applications have entered users' lives, especially a series of software that can shoot short videos, which are very popular among users.
[0003] To enhance the fun of video shooting, the app also provides users with the ability to add special effects to videos. This can be understood as the app first constructing a plane in virtual space based on 3D information (such as point cloud data), and then loading the user-selected effects onto that plane. However, as more 3D information is acquired, the app still rigidly loads the effects onto a single, pre-constructed plane, making the effect-adding operation very limited and unable to meet the diverse needs of users. Summary of the Invention
[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for generating special effects videos, which realizes the technical effect of dynamically constructing multiple planes in three-dimensional space. This not only improves the flexibility of adding special effects, but also meets the diverse needs of users and enhances the user experience.
[0005] In a first aspect, embodiments of this disclosure provide a method for generating special effects videos, including:
[0006] When it is detected that the current video frame to be processed includes point cloud data to be processed, the distance information between the point cloud data to be processed and each historical estimation plane is determined; wherein, the historical estimation plane is determined based on the historical point cloud data to be processed;
[0007] If the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the point cloud data to be processed is estimated based on the random sampling consensus algorithm to generate a target estimation plane, so as to display the target effect corresponding to the current video frame to be processed based on each estimation plane, and thus obtain the target effect video frame.
[0008] Secondly, this disclosure also provides a special effects video generation apparatus, including:
[0009] The distance information determination module is used to determine the distance information between the point cloud data to be processed and each historical estimation plane when the current video frame to be processed is detected to include point cloud data to be processed; wherein the historical estimation plane is determined based on the historical point cloud data to be processed.
[0010] The target estimation plane generation module is used to perform plane estimation on the point cloud data to be processed based on the random sampling consensus algorithm if the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, generate a target estimation plane, and display the target effect corresponding to the current video frame to be processed based on each estimated plane to obtain the target effect video frame.
[0011] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:
[0012] One or more processors;
[0013] Storage device for storing one or more programs.
[0014] When the one or more programs are executed by the one or more processors, the one or more processors implement the special effects video generation method as described in any of the embodiments of this disclosure.
[0015] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the special effects video generation method as described in any of the embodiments of this disclosure.
[0016] The technical solution of this disclosure, when detecting that the current video frame to be processed includes point cloud data to be processed, determines the distance information between the point cloud data to be processed and each historical estimation plane. Furthermore, if the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the point cloud data to be processed is estimated based on the random sampling consensus algorithm to generate a target estimation plane. Based on each estimation plane, the target special effect corresponding to the current video frame to be processed is displayed, and the target special effect video frame is obtained. This achieves the technical effect of constructing multiple planes in three-dimensional space, which not only improves the flexibility of adding special effects, but also meets the diverse needs of users and improves the user experience. Attached Figure Description
[0017] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0018] Figure 1 This is a schematic flowchart of a special effects video generation method provided in Embodiment 1 of this disclosure;
[0019] Figure 2 This is a schematic flowchart of a special effects video generation method provided in Embodiment 2 of this disclosure;
[0020] Figure 3 This is a schematic diagram of the structure of a special effects video generation device provided in Embodiment 3 of this disclosure;
[0021] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of this disclosure. Detailed Implementation
[0022] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0023] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0024] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0025] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules, or units, and are not used to limit the order of functions performed by these devices, modules, or units or their interdependencies. It should also be noted that the modifications of "a" and "a plurality of" mentioned in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0026] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0027] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0028] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0029] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0030] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0031] Before introducing this technical solution, the application scenarios of this disclosure embodiment can be illustrated by example. For instance, when a user shoots a video using application software, or engages in a video call with other users, there may be a personalized need to add special effects to the current video frame with a high degree of freedom. However, in the prior art, applications can only construct a single plane to carry the special effects based on 3D information (such as point cloud data). Obviously, this method cannot meet the user's above-mentioned needs. At this time, according to the technical solution of this embodiment, the application can dynamically construct multiple corresponding planes in the process of continuously acquiring 3D information, that is, provide the user with multiple objects to carry the special effects, thereby satisfying the user's need to add special effects according to their own expectations and create special effects videos.
[0032] Example 1
[0033] Figure 1 This is a schematic diagram of a special effects video generation method provided in Embodiment 1 of this disclosure. This embodiment of the disclosure is applicable to situations where multiple planes are dynamically constructed in the process of continuously acquiring point cloud data. This method can be executed by a special effects video generation device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, such as a mobile terminal, a PC, or a server.
[0034] like Figure 1 As shown, the method includes:
[0035] S110. When it is detected that the current video frame to be processed includes point cloud data to be processed, determine the distance information between the point cloud data to be processed and each historical estimated plane.
[0036] First, it should be noted that the apparatus for executing the special effects video generation method provided in this disclosure can be integrated into application software that supports special effects video processing functions, and this software can be installed on an electronic device, optionally a mobile terminal or a PC. The application software can be a type of software for image / video processing; specific application software will not be detailed here, as long as it can perform image / video processing. Alternatively, it can be a specially developed application program to add and display special effects, or it can be integrated into a corresponding page, allowing users to process special effects videos through the integrated page on a PC.
[0037] In this embodiment, the user can capture depth video using a mobile terminal's camera device, and each resulting video frame is the video frame to be processed. It is understood that each frame of the depth video contains color and depth information of the captured target area. Based on this, the application can use point cloud computing technology to detect and obtain corresponding point cloud data (PCD) at various moments during the user's video capture process. Those skilled in the art should understand that point cloud data is commonly used in reverse engineering and is data recorded in the form of points. These points can be coordinates in three-dimensional space, or information such as color or light intensity. In practical applications, point cloud data generally also includes point coordinate accuracy, spatial resolution, and surface normal vectors, and is generally saved in PCD format. This format offers strong operability and can improve the speed of point cloud data processing (e.g., registration and fusion of point cloud data) in subsequent processes. In this embodiment, for any video frame to be processed at any given time, the application can determine the point cloud data to be processed in the video frame in real time using Simultaneous Localization and Mapping (SLAM) technology.
[0038] In this embodiment, the application utilizes point cloud data detected from one or more video frames to be processed to construct one or more planes in a virtual 3D space. This plane construction process is essentially a plane estimation process, and the point cloud data serving as the data foundation is the point cloud data to be processed. Plane estimation refers to the system using a specific algorithm to estimate the plane when a large number of 3D spatial points are detected, until the system detects no more than enough 3D spatial points to be processed. The following explanation uses the example of the application detecting point cloud data to be processed from a single video frame corresponding to the current moment and performing plane estimation based on this data.
[0039] In this embodiment, when the application detects point cloud data to be processed within the current video frame, it first needs to determine the distance information between this point cloud data and each historically estimated plane in the virtual 3D space. The historically estimated planes are determined based on historical point cloud data. This can be understood as follows: multiple video frames prior to the current moment also contain a large amount of point cloud data, and the application has already constructed one or more planes in the virtual 3D space based on this point cloud data. Therefore, for the current moment, the one or more constructed planes are the historically estimated planes.
[0040] Furthermore, the process of determining the distance information between the point cloud data and each historical estimation plane can be understood as deciding whether to merge these points into the historical estimation plane or to reconstruct a new estimation plane. Optionally, when determining the distance information, the distance information from the point cloud data to be processed to each historical estimation plane can be determined based on the coordinate information of the point cloud data to be processed and the planar information of each historical estimation plane.
[0041] Specifically, before determining the distance information between point cloud data and each historical estimated plane, it is first necessary to construct the plane equation. This can be understood as follows: a plane in 3D space can be uniquely defined by a point on the plane and a normal vector perpendicular to that plane. Based on this, the normal vector is first defined. And a point p1(x1,y1,z1) on the plane. Furthermore, for any point p(x,y,z) on the plane, a vector pointing from p1 to p can be defined on the plane, that is:
[0042]
[0043] Due to the normal line Since it is perpendicular to the plane, the normal must also be perpendicular to the vector located on the plane. The dot product of the two is 0, that is:
[0044]
[0045] It can be understood that the above formula is the vector form of the plane equation, and correspondingly, it can be obtained by calculating the dot product:
[0046] (a,b,c)·(x-x1,y-y1,z-z1)=0
[0047] Based on the above derivation, we can obtain:
[0048] ax + by + cz - (ax1 + by1 + cz1) = 0
[0049] Substituting the constant part of the algebraic form of the plane equation with d = -(ax1 + by1 + cz1) yields the algebraic form of the plane equation:
[0050] ax + by + cz + d = 0
[0051] Furthermore, if the above normal is a normalized normal, then the constant expression d in the plane equation is the distance from the origin to the plane. Specifically, given a normalized normal vector... Given a point p1(Da1,Db1,Dc1) on the plane, substituting the normal vector and the point into the plane equation yields:
[0052] (a1,b1,c1)·(x-Da1,y-Db1,z-Dc1)=0
[0053] Based on the above derivation, we can obtain:
[0054] a1x+b1y+c1z-D=0
[0055] Based on this, the distance from the origin to the plane can be calculated by dividing the standard plane equation by the normal modulus (normal length). For example, based on the above formula, the distance from the origin to the plane (x+2y+2z-6=0) with (1,2,2) as the normal can be calculated to be 2.
[0056] After obtaining the above formula, we can calculate the formula for the distance D from any point p2(x2,y2,z2) in space to the plane, that is:
[0057]
[0058] Based on the above formula, the distance D is obtained by substituting point p2 into the plane equation and dividing by the magnitude of the normal. For example, based on the above formula, the distance from point (-1, -2, -3) to the plane (x + 2y + 2z - 6 = 0) can be calculated as follows: It should be noted that in practical applications, the calculated distances are signed. The application can determine which side of a historical estimation plane each point in the point cloud data to be processed is located on based on the sign. For example, when the distance corresponding to a point is greater than zero, it indicates that the point is on the front side of a historical estimation plane - the side that the normal points to. Conversely, when the distance corresponding to a point is less than zero, it indicates that the point is on the back side of the historical estimation plane - the side that the normal points to the opposite side. When the distance of a point is zero, it indicates that the point is on the historical estimation plane.
[0059] It is understood that for other points in the point cloud data, the distance information to the historical estimation plane can also be determined according to the above calculation method. At the same time, when there are multiple historical estimation planes in the virtual three-dimensional space, for each point in the point cloud data, the application also needs to determine its distance information to each historical estimation plane according to the above calculation method. This will not be elaborated further in this embodiment.
[0060] S120. If the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the plane estimation of the point cloud data to be processed is performed based on the random sampling consensus algorithm to generate the target estimation plane, so as to display the target effect corresponding to the current video frame to be processed based on each estimation plane, and obtain the target effect video frame.
[0061] In this embodiment, after determining the distance information between each point in the point cloud data and each historical estimation plane, the application also needs to determine whether the distance information and the amount of data in the point cloud data to be processed meet the plane estimation conditions. This can be understood as determining the distance between each point in the point cloud data and each historical estimation plane, and then determining whether a new estimation plane needs to be constructed based on the point cloud data to be processed. This process is described below.
[0062] Optionally, if the distance information is greater than the preset distance threshold in the plane estimation condition, the amount of point cloud data to be processed is accumulated to obtain the current amount of data; if the current amount of data reaches the data amount threshold in the plane estimation condition, the plane estimation processing of each currently stored point cloud data to be processed is performed based on the random sampling consensus algorithm to generate the target estimation plane.
[0063] Specifically, the application can preset a distance threshold, which can be understood as a critical value for determining whether the point cloud needs to be fused to the historical estimation plane. Furthermore, when the calculated distance information of a point in the point cloud data to be processed is greater than the preset distance threshold, it indicates that the point does not need to be fused to the historical estimation plane. Simultaneously, when judging a large number of points in the point cloud data to be processed based on the preset distance threshold, if it is determined that the distance information corresponding to multiple points is greater than the preset distance threshold, the application also needs to accumulate the data volume of these points to determine the current data volume in real time. Those skilled in the art should understand that the accumulated point cloud data can be stored in a cache or a specific storage space, which will not be elaborated further in this embodiment.
[0064] In this embodiment, the current data volume is the parameter used to determine whether a new estimation plane needs to be constructed based on the point cloud data to be processed. Specifically, the application can preset a data volume threshold. If the current data volume reaches the data volume threshold in the plane estimation condition, it indicates that the application can construct a new estimation plane, i.e., the target estimation plane, based on the accumulated point cloud data to be processed. In practical applications, the application can use the Random Sample Consensus (RANSAC) algorithm to perform plane estimation on the accumulated point cloud data to be processed. Those skilled in the art should understand that, based on the RANSAC algorithm, the application can iteratively estimate the parameters of the mathematical model from a set of observed data containing outliers (i.e., the accumulated point cloud data to be processed), i.e., the parameters used to generate the target estimation plane. Specifically, the RANSAC algorithm first assumes that the point cloud data to be processed contains correct data and outlier data (or noise). Further, correct data is marked as inliers, and outlier data is marked as outliers. Meanwhile, RANSAC also assumes that given a correct set of data, there exists a method to calculate model parameters that fit these point cloud data to be processed, thereby generating the target estimation plane.
[0065] In this embodiment, for the accumulated point cloud data to be processed, the application based on the RANSAC algorithm can generate either one target estimation plane or multiple target estimation planes. This can be understood as follows: when the application generates only one target estimation plane, it indicates that the distance between the points in the accumulated point cloud data to be processed and the target estimation plane is less than a preset distance threshold. When the application generates multiple target estimation planes, it indicates that only a portion of the points in the accumulated point cloud data to be processed are less than the preset distance threshold when they are between them and a target estimation plane, while the distance between other points and the target estimation plane is greater than the preset distance threshold. Therefore, it is necessary to construct other target estimation planes based on these points.
[0066] It should be noted that if the current data volume does not reach the data volume threshold, the current data volume is accumulated and stored as point cloud data to be processed. When the current data volume reaches the data volume threshold, the stored point cloud data to be processed is subjected to plane estimation processing to obtain the target estimation plane. This can be understood as follows: before generating the special effects video, the application can pre-allocate a certain amount of space in a specific storage space or memory. When the current data volume does not reach the data volume threshold, the accumulated point cloud data will be stored in the aforementioned storage space or memory. Simultaneously, the stored data volume is monitored in real time. When it is determined that the data volume has reached the data volume threshold, the application can generate the target estimation plane according to the above method. Further details are omitted here.
[0067] It should also be noted that in the actual process of determining the distance information between points in the point cloud data to be processed and the historical estimation planes, there are cases where the distance information is less than a preset distance threshold. Optionally, if the distance information is less than the preset distance threshold in the plane estimation conditions, then the target historical estimation plane corresponding to the point cloud data to be processed is determined, and the point cloud data to be processed is fused to the target historical estimation plane. This can be understood as follows: for points whose distance information is less than the preset distance threshold, the application does not need to generate new target estimation planes in the virtual 3D space based on these points; it only needs to fuse these points to the historical estimation planes that are closest to them. These historical estimation planes are the target estimation planes.
[0068] Those skilled in the art should understand that before fusing the points in the point cloud data to be processed to the corresponding target historical estimation plane, the point cloud needs to be registered. That is, a large number of points are superimposed and matched into a unified coordinate system, the corresponding translation and rotation matrices are calculated, and redundant information is eliminated. The registration of the point cloud data to be processed can be divided into three categories according to different image input conditions and reconstruction output requirements: coarse registration, fine registration, and global registration. Furthermore, after the point cloud data to be processed is registered, the application can perform fusion processing based on a pre-written point cloud fusion program, that is, fuse each point to the historical estimation plane with the nearest distance.
[0069] In this embodiment, once the application determines multiple estimated planes in the virtual three-dimensional space, it can detect the user's triggering operation in real time, thereby loading the target special effect selected by the user onto the corresponding estimated plane, thus achieving the effect of adding the special effect to the video screen according to the user's expectations.
[0070] Specifically, the application can pre-provide users with multiple special effects templates. Each template is associated with a corresponding 2D texture or 3D model, such as a cartoon illustration or a 3D model. Furthermore, each template can be labeled with an identifier representing the effect name and associated with multiple pre-developed controls within the application. Based on this, when a user selects an effect as the target effect using a control at the current video frame, the application can load the associated 2D texture or 3D model onto any estimated plane according to the user's actual needs. This process writes the information of each point in the video frame to be processed, as well as the points on the texture or model, into the rendering engine. The rendering engine then renders the target effect video frame corresponding to the current video frame. Those skilled in the art should understand that the rendering engine can be a program that controls the graphics processing unit (GPU) to render relevant images. In this embodiment, after the information of each point is written into the rendering engine, the computer can complete the drawing task of the target effect video frame under the engine's drive. Further details are omitted here.
[0071] The technical solution of this disclosure, when detecting that the current video frame to be processed includes point cloud data to be processed, determines the distance information between the point cloud data to be processed and each historical estimation plane. Further, if the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the point cloud data to be processed is estimated based on the random sampling consensus algorithm to generate a target estimation plane, so as to display the target special effect corresponding to the current video frame to be processed based on each estimation plane, thereby obtaining the target special effect video frame. This achieves the technical effect of dynamically constructing multiple planes in three-dimensional space, which not only improves the flexibility of adding special effects, but also meets the diverse needs of users and improves the user experience.
[0072] Example 2
[0073] Figure 2 This is a schematic flowchart of a special effects video generation method provided in Embodiment 2 of this disclosure. Based on the aforementioned embodiments, when the application detects point cloud data to be processed again in a subsequent process, it can dynamically update the estimated plane within the virtual three-dimensional space. Furthermore, the target display position of the target special effects is determined based on the touch point position information, improving the flexibility of adding special effects and making it easier to meet the personalized needs of users in the special effects video production process. Specific implementation methods can be found in the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0074] like Figure 2 As shown, the method specifically includes the following steps:
[0075] S210. When it is detected that the current video frame to be processed includes point cloud data to be processed, determine the distance information between the point cloud data to be processed and each historical estimated plane.
[0076] S220. If the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the plane estimation of the point cloud data to be processed is performed based on the random sampling consensus algorithm to generate the target estimation plane, so as to display the target effect corresponding to the current video frame to be processed based on each estimation plane, and obtain the target effect video frame.
[0077] S230. If new point cloud data to be processed is detected again in the video frame to be processed, the target estimation plane is added to the historical estimation plane, and the distance information between the point cloud data to be processed and each historical estimation plane is determined.
[0078] In this embodiment, the target estimation plane and the historical estimation plane are relative concepts. It can be understood that in the subsequent process, the target estimation plane generated at the current moment is the historical estimation plane.
[0079] Specifically, if one or more target estimation planes have already been generated based on the point cloud data in the video frame to be processed at the current moment, the application can dynamically determine multiple video frames to be processed during subsequent video shooting by the user, and detect the content of each video frame. Simultaneously, the target estimation planes are used as historical estimation planes. For example, if ten historical estimation planes already exist in the virtual 3D space, and the application generates two target estimation planes based on the point cloud data of the video frame to be processed at the current moment, these two target estimation planes will also be used as historical estimation planes for any further detected point cloud data to be processed. That is to say, there are a total of twelve historical estimation planes in the virtual 3D space.
[0080] Based on this, when the application detects the point cloud data to be processed again in the video frame to be processed, the distance information between each point in the new point cloud data to be processed and each historical estimation plane can be determined in accordance with the method of Embodiment 1 of this disclosure. Then, the distance information is judged based on the preset distance threshold to determine whether to fuse these points to the nearest historical estimation plane or to regenerate the target estimation plane based on these points.
[0081] It should be noted that regardless of when the target estimation plane is generated from the point cloud data in the video frame to be processed, the application can save the newly generated target estimation plane. The advantage of this is that when point cloud data corresponding to any of the estimated planes is detected in subsequent video frames, the corresponding estimated planes can be reused without regenerating them, avoiding waste of computing resources and improving the processing efficiency of special effects videos.
[0082] S240. When it is detected that a target effect is to be added to the current video frame to be processed, the target display position of the target effect is determined based on the touch point position information of the display interface and each historical estimation plane; the target effect is displayed based on the target display position to obtain the target effect video frame corresponding to the current video frame to be processed.
[0083] The target effect can also be an augmented reality (AR) effect. Specifically, when it detects that an AR effect is being added to the current video frame to be processed, the application can determine the touch point location information. At the same time, based on multiple historical estimation planes contained in the three-dimensional space, it can further determine the target display position of the AR effect in space. The target display position is the position used to carry the 3D model corresponding to the AR effect.
[0084] For example, the current 3D space includes an estimated plane corresponding to the ground and an estimated plane corresponding to the desktop. Based on this, when the application detects touch point location information, it can generate a ray from the touch point location as the origin into the 3D space. The intersection of this ray with one of the estimated planes is then used as the target display location. For instance, when the ray intersects with the estimated plane corresponding to the desktop, it indicates that the AR effect needs to be displayed on the desktop according to the user's requirements. The advantage of generating multiple estimated planes to carry AR effects is that it not only improves the flexibility of adding AR effects and avoids the problem of the added AR effects being too fixed when only a single plane is constructed in the space, but also meets the personalized needs of users in the process of creating special effects videos.
[0085] In this embodiment, after determining the target display position of the target effect, the application can load the 2D texture or 3D model associated with the target effect based on the position, thereby sending the point information of the video frame loaded with the effect to the rendering engine to render the target effect video frame in accordance with the method of Embodiment 1 of this disclosure.
[0086] In this embodiment, when the application detects the point cloud data to be processed again in a subsequent process, it needs to continue to determine the distance between each point and the historical estimation plane, and merge each point into the historical estimation plane, or construct a new target estimation plane, thereby realizing the dynamic update of the estimation plane in the virtual three-dimensional space; furthermore, the target display position of the target effect is determined according to the touch point position information, which improves the flexibility of adding effects and makes it easier to meet the personalized needs of users in the process of creating special effects videos.
[0087] Example 3
[0088] Figure 3 This is a schematic diagram of the structure of a special effects video generation device provided in Embodiment 3 of this disclosure, as shown below. Figure 3 As shown, it includes: a distance information determination module 310 and a target estimation plane generation module 320.
[0089] The distance information determination module 310 is used to determine the distance information between the point cloud data to be processed and each historical estimation plane when the current video frame to be processed is detected to include point cloud data to be processed; wherein the historical estimation plane is determined based on the historical point cloud data to be processed.
[0090] The target estimation plane generation module 320 is used to perform plane estimation on the point cloud data to be processed based on the random sampling consensus algorithm if the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, generate a target estimation plane, and display the target effect corresponding to the current video frame to be processed based on each estimated plane to obtain the target effect video frame.
[0091] Optionally, the distance information determination module 310 is further configured to determine the distance information from the point cloud data to each historical estimation plane based on the coordinate information of the point cloud data to be processed and the plane information of each historical estimation plane.
[0092] Based on the above technical solutions, the target estimation plane generation module 320 includes a point cloud data accumulation unit and a target estimation plane generation unit.
[0093] The point cloud data accumulation unit is used to accumulate the point cloud data to be processed if the distance information is greater than the preset distance threshold in the plane estimation condition, so as to obtain the current data volume.
[0094] The target estimation plane generation unit is used to generate a target estimation plane by performing plane estimation processing on each currently stored point cloud data to be processed based on the random sampling consensus algorithm if the current data volume reaches the data volume threshold in the plane estimation condition.
[0095] Based on the above technical solutions, the special effects video generation device also includes a point cloud data fusion module to be processed.
[0096] The point cloud data fusion module is used to determine the target historical estimation plane corresponding to the point cloud data to be processed if the distance information is less than the preset distance threshold in the plane estimation conditions, and to fuse the point cloud data to be processed onto the target historical estimation plane.
[0097] Based on the above technical solutions, the special effects video generation device also includes a point cloud data storage module to be processed.
[0098] The point cloud data storage module is used to accumulate the current data volume and store the point cloud data to be processed if the current data volume does not reach the data volume threshold. When the current data volume reaches the data volume threshold, the stored point cloud data to be processed is subjected to plane estimation processing to obtain the target estimation plane.
[0099] Based on the above technical solutions, the special effects video generation device also includes an estimation plane update module.
[0100] The estimation plane update module is used to add the target estimation plane to the historical estimation plane and determine the distance information between the point cloud data to be processed and each historical estimation plane when new point cloud data to be processed is detected again in the video frame to be processed.
[0101] Based on the above technical solutions, the special effects video generation device also includes a target special effects video frame generation module.
[0102] The target effect video frame generation module is used to determine the target display position of the target effect based on the touch point position information of the display interface and each historical estimation plane when it is detected that a target effect is to be added to the current video frame to be processed; and to display the target effect based on the target display position to obtain the target effect video frame corresponding to the current video frame to be processed.
[0103] The technical solution provided in this embodiment, when detecting that the current video frame to be processed includes point cloud data to be processed, determines the distance information between the point cloud data to be processed and each historical estimated plane. Furthermore, if the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the point cloud data to be processed is estimated based on the random sampling consensus algorithm to generate a target estimated plane. Based on each estimated plane, the target special effect corresponding to the current video frame to be processed is displayed, and the target special effect video frame is obtained. This achieves the technical effect of dynamically constructing multiple planes in three-dimensional space, which not only improves the flexibility of adding special effects, but also meets the diverse needs of users and improves the user experience.
[0104] The special effects video generation apparatus provided in this disclosure can execute the special effects video generation method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0105] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.
[0106] Example 4
[0107] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of this disclosure. Refer to the following... Figure 4 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 4 The diagram below shows the structure of the terminal device or server 400. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 4 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0108] like Figure 4 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, pattern processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 406 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Edit / output (I / O) interface 405 is also connected to bus 404.
[0109] Typically, the following devices can be connected to I / O interface 405: editing devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0110] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 406, or installed from ROM 402. When the computer program is executed by processing device 401, it performs the functions defined in the methods of embodiments of this disclosure.
[0111] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0112] The electronic device provided in this embodiment and the special effects video generation method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0113] Example 5
[0114] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the special effects video generation method provided in the above embodiments.
[0115] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0116] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0117] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0118] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to:
[0119] When it is detected that the current video frame to be processed includes point cloud data to be processed, the distance information between the point cloud data to be processed and each historical estimation plane is determined; wherein, the historical estimation plane is determined based on the historical point cloud data to be processed;
[0120] If the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the point cloud data to be processed is estimated based on the random sampling consensus algorithm to generate a target estimation plane, so as to display the target effect corresponding to the current video frame to be processed based on each estimation plane, and thus obtain the target effect video frame.
[0121] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0122] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0123] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".
[0124] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0125] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0126] According to one or more embodiments of this disclosure, [Example 1] provides a method for generating special effects videos, the method comprising:
[0127] When it is detected that the current video frame to be processed includes point cloud data to be processed, the distance information between the point cloud data to be processed and each historical estimation plane is determined; wherein, the historical estimation plane is determined based on the historical point cloud data to be processed;
[0128] If the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the point cloud data to be processed is estimated based on the random sampling consensus algorithm to generate a target estimation plane, so as to display the target effect corresponding to the current video frame to be processed based on each estimation plane, and thus obtain the target effect video frame.
[0129] According to one or more embodiments of this disclosure, [Example 2] provides a method for generating special effects videos, the method further comprising:
[0130] Optionally, the distance information from the point cloud data to each historical estimation plane is determined based on the coordinate information of the point cloud data to be processed and the planar information of each historical estimation plane.
[0131] According to one or more embodiments of this disclosure, [Example 3] provides a method for generating special effects videos, the method further comprising:
[0132] Optionally, if the distance information is greater than the preset distance threshold in the plane estimation condition, the amount of point cloud data to be processed is accumulated to obtain the current amount of data;
[0133] If the current data volume reaches the data volume threshold in the plane estimation condition, then the plane estimation process of each currently stored point cloud data to be processed is performed based on the random sampling consensus algorithm to generate the target estimation plane.
[0134] According to one or more embodiments of this disclosure, [Example 4] provides a method for generating special effects videos, the method further comprising:
[0135] Optionally, if the distance information is less than a preset distance threshold in the plane estimation condition, a target historical estimation plane corresponding to the point cloud data to be processed is determined, and the point cloud data to be processed is fused to the target historical estimation plane.
[0136] According to one or more embodiments of this disclosure, [Example 5] provides a method for generating special effects videos, the method further comprising:
[0137] Optionally, if the current data volume does not reach the data volume threshold, the current data volume is accumulated and the point cloud data to be processed is stored, so that when the current data volume reaches the data volume threshold, the stored point cloud data to be processed is subjected to plane estimation processing to obtain the target estimation plane.
[0138] According to one or more embodiments of this disclosure, [Example Six] provides a method for generating special effects videos, the method further comprising:
[0139] Optionally, if new point cloud data to be processed is detected again in the video frame to be processed, the target estimation plane is added to the historical estimation plane, and the distance information between the point cloud data to be processed and each historical estimation plane is determined.
[0140] According to one or more embodiments of this disclosure, [Example Seven] provides a method for generating special effects videos, the method further comprising:
[0141] Optionally, when it is detected that a target effect is to be added to the current video frame to be processed, the target display position of the target effect is determined based on the touch point position information of the display interface and each historical estimation plane;
[0142] The target effect is displayed based on the target display position, thereby obtaining a target effect video frame corresponding to the current video frame to be processed.
[0143] According to one or more embodiments of this disclosure, [Example Eight] provides a special effects video generation apparatus, the apparatus comprising:
[0144] The distance information determination module is used to determine the distance information between the point cloud data to be processed and each historical estimation plane when the current video frame to be processed is detected to include point cloud data to be processed; wherein the historical estimation plane is determined based on the historical point cloud data to be processed.
[0145] The target estimation plane generation module is used to perform plane estimation on the point cloud data to be processed based on the random sampling consensus algorithm if the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, generate a target estimation plane, and display the target effect corresponding to the current video frame to be processed based on each estimated plane to obtain the target effect video frame.
[0146] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0147] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0148] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for generating a special effect video, characterized by, include: When it is detected that the current video frame to be processed includes point cloud data to be processed, the distance information between the point cloud data to be processed and each historical estimation plane is determined; wherein, the historical estimation plane is determined based on the historical point cloud data to be processed; If the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, then the point cloud data to be processed is estimated based on the random sampling consensus algorithm to generate a target estimation plane, including: if the distance information is greater than the preset distance threshold in the plane estimation conditions, then the amount of data of the point cloud data to be processed is accumulated to obtain the current amount of data; If the current data volume reaches the data volume threshold in the plane estimation condition, then the plane estimation processing of each currently stored point cloud data to be processed is performed based on the random sampling consensus algorithm to generate a target estimation plane; based on each estimation plane, the target effect corresponding to the current video frame to be processed is displayed to obtain the target effect video frame; The estimated planes include the historical estimated planes and the target estimated planes generated when the plane estimation conditions are met.
2. The method of claim 1, wherein, Determining the distance information between the point cloud data to be processed and each historical estimated plane includes: Based on the coordinate information of the point cloud data to be processed and the planar information of each historical estimation plane, the distance information from the point cloud data to be processed to each historical estimation plane is determined.
3. The method of claim 1, wherein, Also includes: If the distance information is less than the preset distance threshold in the plane estimation condition, then the target historical estimation plane corresponding to the point cloud data to be processed is determined, and the point cloud data to be processed is fused to the target historical estimation plane.
4. The method of claim 1, wherein, Also includes: If the current data volume does not reach the data volume threshold, the current data volume is accumulated and the point cloud data to be processed is stored. When the current data volume reaches the data volume threshold, the stored point cloud data to be processed is subjected to plane estimation processing to obtain the target estimation plane.
5. The method of claim 1, wherein, Also includes: If new point cloud data to be processed is detected again in the video frame to be processed, the target estimation plane is added to the historical estimation plane, and the distance information between the point cloud data to be processed and each historical estimation plane is determined.
6. The method of claim 1, wherein, Also includes: When it is detected that a target effect is to be added to the current video frame to be processed, the target display position of the target effect is determined based on the touch point position information of the display interface and each historical estimated plane; The target effect is displayed based on the target display position, thereby obtaining a target effect video frame corresponding to the current video frame to be processed.
7. An apparatus for generating a special effect video, characterized by comprising: include: The distance information determination module is used to determine the distance information between the point cloud data to be processed and each historical estimation plane when the current video frame to be processed is detected to include point cloud data to be processed; wherein the historical estimation plane is determined based on the historical point cloud data to be processed. The target estimation plane generation module is used to perform plane estimation on the point cloud data to be processed based on the random sampling consensus algorithm if the distance information and the amount of data of the point cloud data to be processed meet the plane estimation conditions, generate a target estimation plane, display the target effect corresponding to the current video frame to be processed based on each estimated plane, and obtain the target effect video frame. The target estimation plane generation module is further configured to accumulate the amount of point cloud data to be processed to obtain the current amount of data if the distance information is greater than the preset distance threshold in the plane estimation condition; If the current data volume reaches the data volume threshold in the plane estimation condition, then the plane estimation process of each currently stored point cloud data to be processed is performed based on the random sampling consensus algorithm to generate the target estimation plane. The estimated planes include the historical estimated planes and the target estimated planes generated when the plane estimation conditions are met.
8. An electronic device, comprising: The electronic device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the special effects video generation method as described in any one of claims 1-6.
9. A storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the special effects video generation method as described in any one of claims 1-6.
Citation Information
Patent Citations
Method and apparatus for determining plane in point cloud data, image superposition method and device
CN107341804A
Augmented reality multi-plane model animation interaction method, device and equipment and storage medium
CN110827376A
