A data processing method and device
By calculating and automatically selecting the original motion data with acceleration parameters greater than the threshold as keyframes, the problem of manual keyframes taking a long time and inaccuracy is solved, and automated batch processing and high accuracy are achieved in the motion capture process.
Patent Information
- Application Number
- CN202011166428.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-27
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2040-10-27
AI Technical Summary
In the prior art, manual keyframe setting is time-consuming and cannot guarantee accuracy, resulting in misjudgment and high labor costs during the motion capture process.
By calculating the acceleration parameters of the original motion data of each frame, automatically judge and select data whose acceleration parameters are greater than the preset threshold as keyframes, the automatic batch processing of keyframes is realized, avoiding manual viewing of each frame of data, and improving processing efficiency and accuracy.
Automatic batch processing of keyframes is realized, processing efficiency is improved, misjudgment caused by personal level and visual fatigue is avoided, and the accuracy of keyframes is ensured.
Smart Images

Figure CN112288838B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method and device. Background Art
[0002] 3D virtual characters are widely used in animation production and movie special effects. The general process is to capture the various actions of the actors through motion capture technology, and then transfer these actions to the specified 3D model. However, there are many problems in the migration process. For example, due to the different body shapes of the actors and the 3D models to be driven, the 3D model may make some actions that do not conform to the principles of physics, such as reaching the hand into the body. This situation is called "model penetration" in the industry.
[0003] To solve the problem of model penetration, the main thing is to correct the motion data of the driving model, that is, to correct the rotation angle of the joint. In the traditional manual correction, the effect is directly checked manually after the correction, and it is enough to make sure it is similar to the original action. When correcting, it is not necessary to correct every frame of action. The data of non-key frames can be interpolated through key frames.
[0004] Manual restoration requires manual setting of key frames, but manual operation may lead to misjudgment due to personal skills, visual fatigue, etc., so the accuracy of the key frames cannot be guaranteed. In addition, manual setting requires manual review of each frame of data, which is time-consuming and labor-intensive. Summary of the invention
[0005] The present invention provides a data processing method and device, which solve the problem in the prior art that manually setting key frames takes a long time and cannot ensure accuracy.
[0006] In a first aspect of the present invention, a data processing method is provided, comprising:
[0007] Calculating the acceleration parameter of each frame of original motion data according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence; wherein the original motion sequence contains multiple frames of original motion data;
[0008] It is determined whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold, and original motion data with acceleration parameters greater than the preset acceleration threshold are selected from the original motion sequence as motion data of the key frame.
[0009] Preferably, the step of calculating the acceleration parameter of each frame of original motion data according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence comprises:
[0010] Calculate the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence;
[0011] According to the acceleration of each joint point corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, the weighted average value of the accelerations of all relevant nodes corresponding to each frame of raw motion data is calculated, and the acceleration parameter of each frame of raw motion data is determined according to the average value.
[0012] Preferably, the step of calculating the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence comprises:
[0013] Subtract the motion data of the joint point corresponding to the previous frame of raw motion data from the motion data of each frame of raw motion data to obtain the motion speed of each joint point in each frame of raw motion data;
[0014] The acceleration of each joint point in each frame of raw motion data is obtained by subtracting the motion speed of the corresponding joint point in each frame of raw motion data from the motion speed of each joint point in the next frame of raw motion data.
[0015] Preferably, before obtaining the motion speed of each joint point in each frame of raw motion data by subtracting the motion data of the joint point corresponding to the previous frame of raw motion data from the motion data of each joint point in each frame of raw motion data, the method further comprises:
[0016] The first frame of original motion data in the original motion sequence is copied as the previous frame of original motion data of the first frame of original motion data.
[0017] Preferably, the motion data of each joint point of each frame of original motion data includes motion data in multiple dimensional directions;
[0018] The step of calculating the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence comprises:
[0019] According to the motion data of multiple joint points contained in each frame of original motion data, the acceleration of each joint point corresponding to each frame of original motion data in multiple dimensional directions is calculated;
[0020] The step of calculating the weighted average value of the accelerations of all related nodes corresponding to each frame of raw motion data according to the acceleration of each joint point corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, and determining the acceleration parameter of each frame of raw motion data according to the average value comprises:
[0021] According to the acceleration of each joint point in multiple dimensional directions corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, the weighted average value of the acceleration of all joint points in each dimensional direction corresponding to each frame of raw motion data is calculated;
[0022] The acceleration parameter of each frame of raw motion data is determined according to the weighted average value of all relevant node accelerations in each dimensional direction corresponding to each frame of raw motion data.
[0023] Preferably, the step of determining the acceleration parameter of each frame of raw motion data according to the weighted average value of all relevant node accelerations in each dimensional direction corresponding to each frame of raw motion data comprises:
[0024] The sum of squares of the average values in multiple dimensional directions corresponding to each frame of original motion data is calculated, and the sum of squares is used as the acceleration parameter of each frame of original motion data.
[0025] Preferably, the step of calculating the acceleration of each joint point in multiple dimensional directions corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data comprises:
[0026] Convert the motion data of multiple joint points contained in each frame of original motion data into multi-dimensional motion data matrices respectively;
[0027] According to the multidimensional motion data matrix of each frame of original motion data, a multidimensional acceleration matrix of each frame of original motion data is obtained, wherein the multidimensional acceleration matrix includes the acceleration of each joint point in multiple dimensional directions.
[0028] Preferably, the total product of the weight coefficients corresponding to all related nodes is 1.
[0029] Preferably, after selecting the original motion data whose acceleration parameter is greater than the preset acceleration threshold as the motion data of the key frame, the method further includes:
[0030] Determine whether the distance between any two adjacent key frames in all key frame motion data is greater than a preset distance threshold;
[0031] When the distance between two adjacent key frames is greater than the preset spacing threshold, in the original motion sequence, original motion data whose distance from the previous key frame of the two adjacent key frames is the preset spacing threshold is selected to supplement the motion data of the key frame.
[0032] In a second aspect of the present invention, there is also provided a data processing device, comprising:
[0033] A first calculation module is used to calculate the acceleration parameter of each frame of original motion data according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence, wherein the original motion sequence contains multiple frames of original motion data;
[0034] The key frame selection module is used to determine whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold, and select the original motion data with acceleration parameters greater than the preset acceleration threshold in the original motion sequence as the motion data of the key frame.
[0035] In a third aspect of the present invention, there is also provided an electronic device, comprising: a processor, a communication interface, a memory and a communication bus; wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0036] Memory, used to store computer programs;
[0037] The processor is used to implement the steps in any of the data processing methods described above when executing the program stored in the memory.
[0038] In a fourth aspect of the implementation of the present invention, there is further provided a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the data processing method as described in any one of the above items is implemented.
[0039] Compared with the prior art, the present invention has the following advantages:
[0040] In an embodiment of the present invention, firstly, the acceleration parameter of each frame of original motion data is calculated according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence; wherein the original motion sequence contains multiple frames of original motion data; then, it is judged whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold value, and the original motion data whose acceleration parameter is greater than the preset acceleration threshold value is selected in the original motion sequence as the motion data of the key frame. In this way, the key data with a greater impact in the entire action process is automatically selected as the key frame through the acceleration parameter, and the automatic batch processing of the key frame selection is realized, without the need to manually check each frame of data, and the processing efficiency of the key frame selection is improved. In addition, the key data with a greater impact in the action process is automatically selected as the key frame according to the acceleration parameter, which avoids misjudgment due to personal level, visual fatigue and other problems, and improves the accuracy of the key frame selection.
[0041] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for describing the embodiments are briefly introduced below.
[0043] Figure 1 A flowchart of a data processing method provided by an embodiment of the present invention;
[0044] Figure 2 A schematic diagram of model joint points provided by an embodiment of the present invention;
[0045] Figure 3 A schematic diagram of repairing motion data provided by an embodiment of the present invention;
[0046] Figure 4 A schematic diagram of a process of supplementing key frames provided in an embodiment of the present invention;
[0047] Figure 5 A schematic block diagram of a data processing device provided by an embodiment of the present invention;
[0048] Figure 6 A schematic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can also be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0050] Figure 1 is a flow chart of a data processing method provided by an embodiment of the present invention, see Figure 1 As shown, the data processing method comprises:
[0051] Step 11: Calculate the acceleration parameters of each frame of original motion data according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence; wherein the original motion sequence contains multiple frames of original motion data.
[0052] Here, by calculating the acceleration parameters of each frame of original motion data, key frames are selected based on the acceleration parameters, thereby converting the key frame calculation into the acceleration parameter calculation, which simplifies the calculation process.
[0053] The original motion sequence is a set of original motion data arranged in time sequence by capturing the motion information of a prototype such as a human body or an animal within a period of time T. The frequency of capturing motion information can be set according to demand. For example, if the motion information is captured at a frequency of 50 frames per second, T = 10s, 500 frames of original motion data can be captured within the time period T. The original motion sequence includes these 500 frames of original motion data arranged in time sequence.
[0054] It is assumed that the original motion sequence includes t frames of original motion data, and t is an integer greater than or equal to 1. The original motion sequence can be recorded as M = {m1, m2, m3, ... m i …,m t}, where m i Represents the original motion data of the i-th frame, 1≤i≤t.
[0055] Assume that each frame of raw motion data includes the motion data of k joint points, where k is an integer greater than or equal to 1. The raw motion data of the i-th frame can be recorded as in, Represents the motion data of the j-th joint point in the i-th frame of original motion data, 1≤j≤k.
[0056] For example, Figure 2 As shown, assuming that there are 34 joint points in total, each frame of original motion data includes motion data of the 34 joint points.
[0057] Step 12: Determine whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold, and select original motion data with acceleration parameters greater than the preset acceleration threshold in the original motion sequence as motion data of the key frame.
[0058] Here, the acceleration parameters are used to realize the automatic selection of key frames, and by taking the original motion data with acceleration parameters greater than the preset acceleration threshold, that is, the movement is larger, as the key frame, the key data with greater influence in the whole movement process is accurately selected, thereby improving the processing efficiency and accuracy.
[0059] For example, Figure 3As shown, assuming that in the 6 frames of raw motion data selected from the original motion sequence, the acceleration parameters of each frame of raw motion data are obtained through step 11, and it is determined through step 12 that only the acceleration parameters of the 1st frame raw motion data and the 6th frame raw motion data meet the condition of being greater than the preset acceleration threshold, then the 1st frame raw motion data and the 6th frame raw motion data are used as key frames, and the other raw motion data are used as non-key frames. When repairing, the 1st frame raw motion data and the 6th frame raw motion data can be repaired, and the repaired data of the other 2-5 frames raw motion data are obtained by interpolating the repaired data of the 1st frame and the 6th frame raw motion data, and finally the obtained Figure 3 The repair motion sequence shown.
[0060] The preset acceleration threshold can be set to any value according to the requirements and is not limited here.
[0061] The data processing method of the embodiment of the present invention automatically selects key data with a greater impact in the entire action process as key frames through acceleration parameters, thereby realizing automatic batch processing of key frame selection without the need to manually check each frame of data, thereby improving the processing efficiency of key frame selection, and automatically selecting key data with a greater impact in the action process as key frames according to acceleration parameters, thereby avoiding misjudgment due to personal level, visual fatigue and other problems, and improving the accuracy of key frame selection.
[0062] Preferably, the above step 11 includes:
[0063] Step 111: Calculate the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence.
[0064] Here, by using the motion data of multiple joint points contained in each frame of original motion data, the acceleration of each joint point corresponding to each frame of original motion data can be accurately calculated, so as to determine the final acceleration parameter by using the acceleration of each joint point.
[0065] Step 112: Calculate the weighted average value of all relevant node accelerations corresponding to each frame of raw motion data based on the acceleration of each joint point corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, and determine the acceleration parameter of each frame of raw motion data based on the average value.
[0066] Here, the acceleration parameter is determined based on the weighted average value of the accelerations of all joint points corresponding to each frame of the original motion data, so that the acceleration parameter integrates the motion conditions of all relevant nodes and takes into account the differences between different joint points. This is used as a standard for selecting key frames, which can more accurately select key data that has a greater impact on the motion.
[0067] Among them, the weight coefficient corresponding to each joint point can be set according to needs, and the embodiment of the present invention does not limit the weight corresponding to each joint point.
[0068] However, in order to ensure that the weight distribution of all joint points is more reasonable, preferably, the total product of the weight coefficients corresponding to all relevant nodes is 1.
[0069] At this time, assuming that w l is the weight coefficient of the lth joint point, then 1≤l≤k.
[0070] Of course, the above-mentioned method of determining the acceleration parameters is only a preferred implementation method, and the acceleration parameters can also be determined in other ways. For example, without considering the differences between different joint points, the average value of the acceleration of all relevant nodes corresponding to each frame of original motion data is directly calculated, and the acceleration parameters are determined based on the average value, which will not be explained one by one here.
[0071] Preferably, the above step 111 includes:
[0072] Step 1111: subtract the motion data of the joint point corresponding to the previous frame of raw motion data from the motion data of each joint point in each frame of raw motion data to obtain the motion speed of each joint point in each frame of raw motion data.
[0073] Here, to determine the acceleration, we first determine the speed, that is, use the motion data of each joint point in each frame of raw motion data, subtract the motion data of the joint point corresponding to the previous frame of raw motion data of each frame of raw motion data, and obtain the motion speed of each joint point in each frame of raw motion data.
[0074] For example, taking the original motion data of frame i For example, using the motion data of each joint point in the original motion data of the i-th frame Subtract the motion data of the joint point corresponding to the original motion data of the i-1th frame to obtain the motion speed of each joint point of the original motion data of the i-th frame, which is expressed by the following formula:
[0075]
[0076] Step 1112: Subtract the movement speed of the corresponding joint point in each frame of raw motion data from the movement speed of each joint point in the next frame of raw motion data to obtain the acceleration of each joint point in each frame of raw motion data.
[0077] Here, after determining the speed, continue to determine the acceleration, that is, use the movement speed of each joint point of the next frame of raw motion data of each frame of raw motion data, subtract the movement speed of the corresponding joint point of each frame of raw motion data, and obtain the acceleration of each joint point of each frame of raw motion data.
[0078] For example, the movement speed of each joint point in the original motion data of the i-th frame For example, the movement speed of each joint point in the original motion data of the i+1th frame is used to subtract the movement speed of the corresponding joint point in the original motion data of the i-th frame to obtain the acceleration of each joint point in the original motion data of the i-th frame, which is expressed as follows:
[0079]
[0080] After obtaining the acceleration of each joint point of the original motion data of the i-th frame, the weighted average value of the acceleration of all related nodes corresponding to the original motion data of the i-th frame can be calculated through step 112, which is expressed by the following formula:
[0081]
[0082] Among them, w l is the weight coefficient of the lth joint point, 1≤l≤k.
[0083] Preferably, before step 1111, the method further includes:
[0084] Step 1110: copy the first frame of original motion data in the original motion sequence as the previous frame of original motion data of the first frame of original motion data.
[0085] Here, since the movement speed of each joint point in each frame of raw motion data is determined based on the previous frame of raw motion data, errors in calculating the first frame of raw motion data can be avoided by copying the first frame of raw motion data in the raw motion sequence to the previous frame of raw motion data.
[0086] Among them, in order to avoid errors in calculating the original motion data of the first frame, other methods can also be used, such as directly skipping the original motion data of the first frame, starting calculation from the original motion data of the second frame, and setting the motion speed of each joint point of the original motion data of the first frame to zero.
[0087] Preferably, the motion data of each joint point of each frame of original motion data includes motion data in multiple dimensional directions; the above step 111 includes:
[0088] Step 1113: Based on the motion data of multiple joint points contained in each frame of original motion data, calculate the acceleration of each joint point in multiple dimensional directions corresponding to each frame of original motion data.
[0089] Here, when the motion data of each joint point includes motion data in multiple dimensional directions, it is necessary to calculate the acceleration of each joint point in multiple dimensional directions to comprehensively analyze the motion data of all related nodes to ensure accuracy.
[0090] Generally, when calculating the model motion data, the motion sequence is analyzed in a three-dimensional coordinate system, and each joint point includes motion data in three dimensions. If the three-dimensional coordinate system includes three coordinate axes, such as X, Y, and Z, then each joint point includes motion data in three directions, such as X, Y, and Z. For example, the motion data of the jth joint point of the original motion data of the i-th frame is It is necessary to calculate the acceleration of the jth joint point in the X, Y, and Z directions of the i-th frame of raw motion data:
[0091]
[0092] To facilitate calculation, preferably, step 1113 includes:
[0093] Step 11131: Convert the motion data of multiple joint points contained in each frame of original motion data into multi-dimensional motion data matrices respectively.
[0094] Here, calculation is performed through conversion matrix, which can simplify the calculation method and improve efficiency.
[0095] For example, taking the original motion data of frame i For example, when each joint point includes motion data in three directions: X, Y, and Z, this step converts m i Convert to a three-dimensional motion data matrix:
[0096]
[0097] Step 11132: According to the multidimensional motion data matrix of each frame of original motion data, obtain the multidimensional acceleration matrix of each frame of original motion data, wherein the multidimensional acceleration matrix includes the acceleration of each joint point in multiple dimensional directions.
[0098] Here, based on the multi-dimensional motion data matrix of each frame of original motion data, a multi-dimensional acceleration matrix of each frame of original motion data is further obtained to determine the acceleration parameter.
[0099] Among them, this step can be based on the method of steps 1111-1112. First, the motion data of each joint point of each frame of original motion data is subtracted from the motion data of the joint point corresponding to the previous frame of original motion data of each frame to obtain a multi-dimensional motion speed matrix of the original motion data of each frame; then, the motion speed of each joint point of the next frame of original motion data of each frame is subtracted from the motion speed of the joint point corresponding to the original motion data of each frame to obtain a multi-dimensional acceleration matrix of the original motion data of each frame.
[0100] For example, still using the original motion data of the i-th frame For example, each joint point includes motion data in three directions: X, Y, and Z. Through this step, according to m i The three-dimensional motion data matrix and m i-1 The three-dimensional motion data matrix First get m i The three-dimensional motion velocity matrix:
[0101]
[0102] Then according to m i The three-dimensional motion velocity matrix and m i+1 The three-dimensional motion velocity matrix Get m i The three-dimensional acceleration matrix of:
[0103]
[0104] On the basis of obtaining the multi-dimensional acceleration matrix of each frame of original motion data, the above step 112 includes:
[0105] Step 1121: Based on the acceleration of each joint point in multiple dimensional directions corresponding to each frame of original motion data and the weight coefficient corresponding to each joint point, calculate the weighted average value of the acceleration of all related nodes in each dimensional direction corresponding to each frame of original motion data.
[0106] Here, based on the acceleration of each joint point in multiple dimensional directions and the corresponding weight coefficient, the weighted average acceleration of all related nodes in each dimensional direction is calculated, so as to integrate the movement of all related nodes in each dimensional direction and take into account the differences between different joint points for calculation, thereby improving the accuracy of the acceleration parameters.
[0107] As mentioned above, other methods may also be used, such as directly calculating the average value of all joint accelerations in each dimensional direction corresponding to each frame of original motion data without considering the differences between different joint points.
[0108] For example, still using the original motion data of the i-th frame For example, each joint point includes motion data in three directions: X, Y, and Z. This step calculates m i The weighted average of all node accelerations in each direction of X, Y, and Z and
[0109] where w l is the weight coefficient of the lth joint point.
[0110] Step 1122: Determine the acceleration parameter of each frame of raw motion data according to the weighted average value of the accelerations of all related nodes in each dimensional direction corresponding to each frame of raw motion data.
[0111] Here, based on the weighted average value of the accelerations of all relevant nodes in each dimensional direction corresponding to each frame of original motion data, the determined acceleration parameters can more comprehensively reflect the motion conditions of each frame of original motion data, thereby improving the accuracy of key frame selection.
[0112] Preferably, the above step 1122 includes:
[0113] Step 1122: Calculate the sum of squares of the average values in multiple dimensional directions corresponding to each frame of original motion data, and use the sum of squares as the acceleration parameter of each frame of original motion data.
[0114] For example, still using the original motion data of the i-th frame For example, each joint point includes motion data in three directions: X, Y, and Z. This step calculates m i The average value in each direction of X, Y, and Z and The sum of the squares is used as the final acceleration parameter and is expressed as follows:
[0115]
[0116] At this time, using the comprehensive acceleration parameter Determine whether to m i As a key frame, specifically, judging by step 12 Is it greater than the preset acceleration threshold a? set ,if Then determine the i-th frame m i is a key frame and can be added to the initial key frame list K.
[0117] Of course, the above-mentioned method of determining the acceleration parameters by calculating the sum of squares is only a preferred implementation method. The embodiments of the present invention may also use other methods to determine the acceleration parameters. For example, after calculating the sum of squares of the weighted average values of the accelerations of all related nodes in multiple dimensional directions, the square root of the sum of squares is calculated, and the square root is used as the acceleration parameter. These are not explained one by one here.
[0118] After a key frame is selected from the original motion sequence through the aforementioned process, in order to ensure the continuity of the action, preferably, after the above step 12 selects the original motion data with an acceleration parameter greater than the preset acceleration threshold as the motion data of the key frame, the method further includes:
[0119] Step 13: Determine whether the distance between any two adjacent key frames in all key frame motion data is greater than a preset distance threshold.
[0120] Step 14: When the distance between two adjacent key frames is greater than the preset spacing threshold, in the original motion sequence, the original motion data whose distance from the previous key frame of the two adjacent key frames is the preset spacing threshold is selected to supplement the motion data of the key frame.
[0121] At this time, when the distance between any two adjacent key frames is greater than the preset spacing threshold, a frame of original motion data within the preset spacing threshold from the previous key frame in the original motion sequence is supplemented as key frame data, avoiding excessive distance between two adjacent key frames, further improving the accuracy of key frame selection, and ensuring continuous and natural movements.
[0122] Here, after step 14, step 13 will continue to determine whether the distance between the supplemented target key frame and the adjacent subsequent key frame is greater than the preset spacing threshold. If it is greater, in the original motion sequence, the original motion data whose distance from the target key frame is the preset spacing threshold will continue to be selected to supplement the motion data of the key frame.
[0123] At this time, multiple key frames may be added between two adjacent key frames to ensure that the distance between any two adjacent key frames is not too large, thereby ensuring the continuity and naturalness of the action.
[0124] Among them, the preset spacing threshold can be set to any value according to needs. For example, if the preset spacing threshold is 6 frames, the distance between any two adjacent key frames cannot exceed 6 frames. If it exceeds, the motion data with an interval of 6 frames from the previous key frame needs to be supplemented as a key frame.
[0125] The following is an example of a specific application process of supplementing key frames in an embodiment of the present invention.
[0126] Assume that after selecting key frames in the original motion sequence through steps 11-12, an initial key frame list K is obtained:
[0127]
[0128] K is an ordered list, k1, k2, k3, etc. are the serial numbers of the key frames in K. The values of k1, k2, k3, etc. may not be continuous. For example, assuming that the first key frame is the third frame of original motion data m3 in the original motion sequence, the second key frame is the fifth frame of original motion data m5 in the original motion sequence, and the third key frame is the eighth frame of original motion data m8 in the original motion sequence, then the values of k1, k2, k3 are 3, 5, and 8 respectively.
[0129] like Figure 4 As shown, the supplementary key frames specifically include:
[0130] S41: Start.
[0131] S42: Set o=0, q=q_set, where q_set is a preset spacing threshold, and o represents the key frame number in the initial key frame list K.
[0132] S43: Set o=o+1.
[0133] S44: Set S=k o .
[0134] S45: Determine whether o+1 is greater than len(K), if so, jump to S410, otherwise, jump to S46.
[0135] Here, it is determined whether o+1 is greater than the total number of frames len(K) in the sequence list K. If so, it means that the last key frame in the sequence list K has been determined, and all adjacent key frames in the sequence list K with larger distances have been supplemented. The process then jumps to S410 to end. Otherwise, it is necessary to jump to S46 to continue supplementing.
[0136] S46: Set E=k o+1 .
[0137] S47: Determine whether ES is greater than q. If so, jump to S48; otherwise, return to S43.
[0138] Here, it is determined whether the distance between the next key frame and the previous key frame is greater than q, where q is equal to a preset spacing threshold. If so, the process jumps to S48 to supplement the key frame, otherwise it returns to S43 to continue determining the next key frame in K.
[0139] S48: Supplement the original motion data of the S+qth frame in the original motion sequence as the motion data of the key frame.
[0140] Here, assuming that o=3, S=k3=8, q=q set =6, then the original motion data m of the S+q=14th frame in the original motion sequence 14 Added as keyframe.
[0141] S49: Set S=S+q, and then return to S45.
[0142] Here, S is set as the supplemented key frame, and then returns to S45 to determine whether the supplement has been completed. If the supplement has been completed, it ends. If not, continue to determine whether the distance between the supplemented key frame and its adjacent next key frame is greater than q through S46-S47. If it is, supplement the key frame, otherwise continue to determine the next key frame in K, and repeat this cycle until all adjacent key frames in the sequence list K with a larger distance are supplemented.
[0143] S410: End.
[0144] At this time, by supplementing key frames, it is ensured that the distance between any two adjacent key frames will not be too large, which further improves the accuracy of key frame selection and ensures the continuity and naturalness of the action.
[0145] The data processing method of the embodiment of the present invention automatically selects key data with a greater impact in the entire action process as key frames through acceleration parameters, thereby realizing automatic batch processing of key frame selection without the need to manually check each frame of data, thereby improving the processing efficiency of key frame selection, and automatically selecting key data with a greater impact in the action process as key frames according to acceleration parameters, thereby avoiding misjudgment due to personal level, visual fatigue and other problems, and improving the accuracy of key frame selection.
[0146] See also Figure 5 As shown, the embodiment of the present invention further provides a data processing device 500, including:
[0147] A first calculation module 501 is used to calculate the acceleration parameter of each frame of original motion data according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence, wherein the original motion sequence contains multiple frames of original motion data;
[0148] The key frame selection module 502 is used to determine whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold, and select the original motion data with acceleration parameters greater than the preset acceleration threshold in the original motion sequence as the motion data of the key frame.
[0149] The data processing device 500 of the embodiment of the present invention automatically selects key data with greater influence in the entire action process as key frames through acceleration parameters, realizes automatic batch processing of key frame selection, eliminates the need for manual review of each frame of data, improves the processing efficiency of key frame selection, and automatically selects key data with greater influence in the action process as key frames according to acceleration parameters, avoids misjudgment due to personal level, visual fatigue and other problems, and improves the accuracy of key frame selection.
[0150] Preferably, the first calculation module 501 includes:
[0151] A first calculation submodule, configured to calculate the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence;
[0152] The second calculation submodule is used to calculate the weighted average value of the accelerations of all relevant nodes corresponding to each frame of raw motion data according to the acceleration of each joint point corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, and determine the acceleration parameter of each frame of raw motion data according to the average value.
[0153] Preferably, the first calculation submodule includes:
[0154] The first processing unit is used to obtain the motion speed of each joint point in each frame of raw motion data by subtracting the motion data of the joint point corresponding to the previous frame of raw motion data from the motion data of each joint point in each frame of raw motion data;
[0155] The second processing unit is used to subtract the movement speed of the joint point corresponding to each frame of raw motion data from the movement speed of each joint point of the next frame of raw motion data to obtain the acceleration of each joint point of each frame of raw motion data.
[0156] Preferably, the device further comprises:
[0157] The copy module is used to copy the first frame of original motion data in the original motion sequence to the previous frame of original motion data of the first frame.
[0158] Preferably, the motion data of each joint point of each frame of original motion data includes motion data in multiple dimensional directions;
[0159] The first calculation submodule includes:
[0160] A first calculation unit, configured to calculate the acceleration of each joint point corresponding to each frame of original motion data in multiple dimensional directions according to the motion data of multiple joint points contained in each frame of original motion data;
[0161] The second calculation submodule includes:
[0162] A second calculation unit is used to calculate the weighted average value of the accelerations of all related nodes in each dimensional direction corresponding to each frame of original motion data according to the accelerations of each joint point in multiple dimensional directions corresponding to each frame of original motion data and the weight coefficient corresponding to each joint point;
[0163] The first determination unit is used to determine the acceleration parameter of each frame of original motion data according to the weighted average value of all relevant node accelerations in each dimensional direction corresponding to each frame of original motion data.
[0164] Preferably, the first determining unit is specifically used for:
[0165] The sum of squares of the average values in multiple dimensional directions corresponding to each frame of original motion data is calculated, and the sum of squares is used as the acceleration parameter of each frame of original motion data.
[0166] Preferably, the first computing unit is specifically used for:
[0167] The motion data of multiple joint points contained in each frame of original motion data are converted into multi-dimensional motion data matrices respectively; according to the multi-dimensional motion data matrix of each frame of original motion data, a multi-dimensional acceleration matrix of each frame of original motion data is obtained, and the multi-dimensional acceleration matrix includes the acceleration of each joint point in multiple dimensional directions.
[0168] Preferably, the total product of the weight coefficients corresponding to all related nodes is 1.
[0169] Preferably, the device further comprises:
[0170] A judging module, used to judge whether the distance between any two adjacent key frames in all key frame motion data is greater than a preset distance threshold;
[0171] The supplementing module is used to select original motion data whose distance from the previous key frame of the two adjacent key frames is the preset spacing threshold in the original motion sequence to supplement the motion data of the key frame when the distance between the two adjacent key frames is greater than the preset spacing threshold.
[0172] The data processing device 500 of the embodiment of the present invention automatically selects key data with greater influence in the entire action process as key frames through acceleration parameters, realizes automatic batch processing of key frame selection, eliminates the need for manual review of each frame of data, improves the processing efficiency of key frame selection, and automatically selects key data with greater influence in the action process as key frames according to acceleration parameters, avoids misjudgment due to personal level, visual fatigue and other problems, and improves the accuracy of key frame selection.
[0173] As for the above-mentioned device embodiment, since it is basically similar to the method embodiment, the relevant parts may refer to the partial description of the method embodiment.
[0174] The embodiment of the present invention further provides an electronic device, which may be a mobile terminal. Figure 6 As shown, it includes a processor 601 , a communication interface 602 , a memory 603 and a communication bus 604 , wherein the processor 601 , the communication interface 602 , and the memory 603 communicate with each other via the communication bus 604 .
[0175] The memory 603 is used to store computer programs.
[0176] When the processor 601 is used to execute the program stored in the memory 603, the following steps are implemented:
[0177] Calculating the acceleration parameter of each frame of original motion data according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence; wherein the original motion sequence contains multiple frames of original motion data;
[0178] It is determined whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold, and original motion data with acceleration parameters greater than the preset acceleration threshold are selected from the original motion sequence as motion data of the key frame.
[0179] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0180] The communication interface is used for communication between the above electronic device and other devices.
[0181] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0182] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0183] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the data processing method described in the above embodiment.
[0184] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the data processing method described in the above embodiment.
[0185] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0186] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0187] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0188] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A data processing method, characterized in that: include: Calculating the acceleration parameters of each frame of original motion data according to the motion data of multiple joints respectively contained in each frame of original motion data in the original motion sequence, including: calculating the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence; calculating the weighted average value of the accelerations of all related nodes corresponding to each frame of original motion data according to the acceleration of each joint point corresponding to each frame of original motion data and the weight coefficient corresponding to each joint point, and determining the acceleration parameters of each frame of original motion data according to the average value; wherein the original motion sequence contains multiple frames of original motion data; It is determined whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold, and original motion data with acceleration parameters greater than the preset acceleration threshold are selected from the original motion sequence as motion data of the key frame.
2. The data processing method according to claim 1, characterized in that: The step of calculating the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence comprises: Subtract the motion data of the joint point corresponding to the previous frame of raw motion data from the motion data of each frame of raw motion data to obtain the motion speed of each joint point in each frame of raw motion data; The acceleration of each joint point in each frame of raw motion data is obtained by subtracting the motion speed of the corresponding joint point in each frame of raw motion data from the motion speed of each joint point in the next frame of raw motion data.
3. The data processing method according to claim 2, characterized in that: Before obtaining the motion speed of each joint point in each frame of raw motion data by subtracting the motion data of the joint point corresponding to the previous frame of raw motion data from the motion data of each joint point in each frame of raw motion data, the method further comprises: The first frame of original motion data in the original motion sequence is copied as the previous frame of original motion data of the first frame of original motion data.
4. The data processing method according to claim 1, characterized in that: The motion data of each joint point of each frame of original motion data includes motion data in multiple dimensional directions; The step of calculating the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data in the original motion sequence comprises: According to the motion data of multiple joint points contained in each frame of original motion data, the acceleration of each joint point corresponding to each frame of original motion data in multiple dimensional directions is calculated; The step of calculating the weighted average value of the accelerations of all related nodes corresponding to each frame of raw motion data according to the acceleration of each joint point corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, and determining the acceleration parameter of each frame of raw motion data according to the average value comprises: According to the acceleration of each joint point in multiple dimensional directions corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, the weighted average value of the acceleration of all joint points in each dimensional direction corresponding to each frame of raw motion data is calculated; The acceleration parameter of each frame of raw motion data is determined according to the weighted average value of all relevant node accelerations in each dimensional direction corresponding to each frame of raw motion data.
5. The data processing method according to claim 4, characterized in that: The step of determining the acceleration parameter of each frame of raw motion data according to the weighted average value of all relevant node accelerations in each dimensional direction corresponding to each frame of raw motion data comprises: The sum of squares of the average values in multiple dimensional directions corresponding to each frame of original motion data is calculated, and the sum of squares is used as the acceleration parameter of each frame of original motion data.
6. The data processing method according to claim 4, characterized in that: The step of calculating the acceleration of each joint point in multiple dimensional directions corresponding to each frame of original motion data according to the motion data of multiple joint points contained in each frame of original motion data comprises: Convert the motion data of multiple joint points contained in each frame of original motion data into multi-dimensional motion data matrices respectively; According to the multidimensional motion data matrix of each frame of original motion data, a multidimensional acceleration matrix of each frame of original motion data is obtained, wherein the multidimensional acceleration matrix includes the acceleration of each joint point in multiple dimensional directions.
7. The data processing method according to claim 1, characterized in that: The total product of the weight coefficients corresponding to all joint points is 1.
8. The data processing method according to claim 1, characterized in that: After selecting the original motion data whose acceleration parameter is greater than the preset acceleration threshold as the motion data of the key frame, the method further includes: Determine whether the distance between any two adjacent key frames in all key frame motion data is greater than a preset distance threshold; When the distance between two adjacent key frames is greater than the preset spacing threshold, in the original motion sequence, original motion data whose distance from the previous key frame of the two adjacent key frames is the preset spacing threshold is selected to supplement the motion data of the key frame.
9. A data processing device, characterized in that: include: A first calculation module is used to calculate the acceleration parameter of each frame of original motion data according to the motion data of multiple joint points respectively contained in each frame of original motion data in the original motion sequence; The original motion sequence includes multiple frames of original motion data, and the first calculation module specifically includes a first calculation submodule, which is used to calculate the acceleration of each joint point corresponding to each frame of original motion data according to the motion data of multiple joint points included in each frame of original motion data in the original motion sequence; The second calculation submodule is used to calculate the weighted average value of the accelerations of all relevant nodes corresponding to each frame of raw motion data according to the acceleration of each joint point corresponding to each frame of raw motion data and the weight coefficient corresponding to each joint point, and determine the acceleration parameter of each frame of raw motion data according to the average value; The key frame selection module is used to determine whether the acceleration parameter of each frame of original motion data is greater than a preset acceleration threshold, and select the original motion data with acceleration parameters greater than the preset acceleration threshold in the original motion sequence as the motion data of the key frame.
