Image processing method, apparatus, electronic device, and storage medium
The present disclosure discloses an image processing method, an apparatus, an electronic device, and a storage medium. The method includes: determining at least one target limb key point of a current video frame; determining at least one current effect key point according to the at least one target limb key point and historical limb key points of at least one historical video frame adjacent to the current video frame; obtaining historical effect key points of the at least one historical video frame according to preset effect parameters, and determining, according to the at least one current effect key point and the historical effect key points, at least one group of target effects matching the preset effect parameters; and determining a target video frame corresponding to the current video frame based on the at least one group of target effects.
1 . An image processing method, comprising:
determining at least one target limb key point of a current video frame;
determining at least one current effect key point according to the at least one target limb key point and historical limb key points of at least one historical video frame adjacent to the current video frame;
obtaining historical effect key points of the at least one historical video frame according to preset effect parameters, and determining, according to the at least one current effect key point and the historical effect key points, at least one group of target effects matching the preset effect parameters; and
determining a target video frame corresponding to the current video frame based on the at least one group of target effects,
wherein determining the at least one current effect key point according to the at least one target limb key point and the historical limb key points of at least one historical video frame adjacent to the current video frame comprises:
determining a plurality of limb key points belonging to a same part as a group of limb key points, wherein the group of limb key points comprises at least one of the target limb key point and the historical limb key points,
for each group of limb key points of a plurality of groups of limb key points, determining a to-be-processed key point according to weight values and corresponding key point coordinates of historical limb key points in each group of limb key points, and
determining at least one current effect key point corresponding to each group of limb key points according to the to-be-processed key point corresponding to each set of key points and a corresponding target key point.
2 . The method of claim 1 , wherein determining the at least one target limb key point of the current video frame comprises:
determining the at least one target limb key point in the current video frame using a limb key point recognition algorithm; or
processing the current video frame using a pre-trained limb key point recognition model, to obtain the at least one target limb key point corresponding to the current video frame.
3 . The method of claim 1 , wherein determining the to-be-processed key point according to the weight values and the corresponding key point coordinates of the historical limb key points in each group of limb key points comprises:
determining a weight value of each historical video frame according to a generation time of each historical video frame, wherein the weight value is inversely proportional to the generation time; and
obtaining an intermediate value by computing a product of key point coordinates of historical limb key points of each historical video frame and the corresponding weight value, and obtaining the to-be-processed key point by accumulating at least one intermediate value.
4 . The method of claim 1 , wherein the preset effect parameters comprise an effect strip display length, and obtaining the historical effect key points of the at least one historical video frame according to the preset effect parameters comprises:
obtaining, according to the effect strip display length, the historical effect key points of at least one historical frame preceding the current video frame.
5 . The method of claim 1 , wherein determining, according to the at least one current effect key point and the historical effect key points, the at least one group of target effects matching the preset effect parameters comprises:
obtaining a plurality of groups of target effects matching the preset effect parameters by processing historical effect key points and the at least one current effect key point of a same part.
6 . The method of claim 1 , wherein determining, according to the at least one current effect key point and the historical effect key points, the at least one group of target effects matching the preset effect parameters comprises:
determining, according to a target effect surface corresponding to the current video frame, a current to-be-processed rendering effect of the at least one current effect key point, and updating historical rendering effects of the historical effect key points in the current video frame; and
determining, according to historical rendering effects and the current to-be-processed rendering effect of a same part, a plurality of groups of target effects matching the preset effect parameters;
wherein a total length of a plurality of target fields in the target effect surface matches a length parameter of an effect strip in the preset effect parameters.
7 . The method of claim 6 , further comprising:
creating a to-be-processed surface corresponding to the target effect;
determining ordinate values corresponding to a plurality of abscissas in the to-be-processed surface, and determining, based on a plurality of ordinate values, a to-be-used surface; and
determining rendering effects of a plurality of points in the to-be-used surface, to obtain the target effect surface.
8 . The method of claim 6 , wherein determining, according to the target effect surface corresponding to the current video frame, the current to-be-processed rendering effect of the at least one current effect key point, and updating the historical rendering effects of the historical effect key points in the current video frame, comprise:
determining abscissas corresponding to the target effect surface according to at least one historical video frame to which the historical effect key points belong, and generation time information of the current video frame; and
determining, according to the abscissas, a current to-be-processed rendering effect of the current video frame, and updating historical rendering effects of historical effect key points corresponding to at least one historical video frame.
9 . The method of claim 6 , wherein determining, according to the target effect surface corresponding to the current video frame, the current to-be-processed rendering effect of the at least one current effect key point, and updating the historical rendering effects of the historical effect key points in the current video frame, comprise:
obtaining historical target effect surfaces of a plurality of historical video frames preceding and adjacent to the current video frame; and
determining, according to a plurality of the historical target effect surfaces and the target effect surface, the current to-be-processed rendering effect of the at least one current effect key point, and updating historical rendering effects of the historical effect key points in the current video frame.
10 . The method of claim 9 , wherein determining, according to the plurality of the historical target effect surfaces and the target effect surface, the current to-be-processed rendering effect of the at least one current effect key point, and updating the historical rendering effects of the historical effect key points in the current video frame, comprise:
determining an effect overlay weight value corresponding to each historical target effect surface;
obtaining, according to each effect overlay weight value and a corresponding target effect surface, to-be-overlaid rendering effects of a plurality of pixel points of each group of historical target effects in at least one group of historical target effects; and
determining, according to the to-be-overlaid rendering effects and the target effect surface of the current video frame, the current to-be-processed rendering effect of the at least one current effect key point, and updating historical rendering effects of the historical effect key points in the current video frame.
11 . The method of claim 10 , wherein determining, according to the to-be-overlaid rendering effects and the target effect surface of the current video frame, the current to-be-processed rendering effect of the at least one current effect key point, and updating the historical rendering effects of the historical effect key points in the current video frame, comprise:
determining, according to the target effect surface of the current video frame, the historical rendering effects of the historical effect key points in the current video frame, and
determining the current to-be-processed rendering effect of the at least one current effect key point; and
overlaying the to-be-overlaid rendering effects onto corresponding pixel points in the current video frame, to update a plurality of the historical rendering effects and the current to-be-processed rendering effect.
12 . The method of claim 11 , further comprising:
in response to detecting that rendering effect values corresponding to a plurality of pixel points are less than a preset rendering effect threshold, clearing the rendering effect values of the plurality of pixel points, to obtain the target video frame corresponding to the current video frame.
13 . The method of claim 1 , wherein determining the target video frame corresponding to the current video frame based on the at least one group of target effects comprises:
adding the at least one group of target effects to a corresponding target limb key point, to obtain the target video frame corresponding to the current video frame.
14 . An electronic device, comprising:
one or more processors; and a storage configured to store one or more computer programs, wherein the one or more computer programs, when executed by the one or more processors, cause the one or more processors to implement operations comprising:
determining at least one target limb key point of a current video frame;
determining at least one current effect key point according to the at least one target limb key point and historical limb key points of at least one historical video frame adjacent to the current video frame;
obtaining historical effect key points of the at least one historical video frame according to preset effect parameters, and determining, according to the at least one current effect key point and the historical effect key points, at least one group of target effects matching the preset effect parameters; and
determining a target video frame corresponding to the current video frame based on the at least one group of target effects,
wherein determining the at least one current effect key point according to the at least one target limb key point and the historical limb key points of at least one historical video frame adjacent to the current video frame comprises:
determining a plurality of limb key points belonging to a same part as a group of limb key points, wherein the group of limb key points comprises at least one of the target limb key point and the historical limb key points,
for each group of limb key points of a plurality of groups of limb key points, determining a to-be-processed key point according to weight values and corresponding key point coordinates of historical limb key points in each group of limb key points, and
determining at least one current effect key point corresponding to each group of limb key points according to the to-be-processed key point corresponding to each set of key points and a corresponding target key point.
15 . The electronic device of claim 14 , wherein determining the at least one target limb key point of the current video frame comprises:
determining the at least one target limb key point in the current video frame using a limb key point recognition algorithm; or
processing the current video frame using a pre-trained limb key point recognition model, to obtain the at least one target limb key point corresponding to the current video frame.
16 . The electronic device of claim 14 , wherein determining the to-be-processed key point according to the weight values and the corresponding key point coordinates of the historical limb key points in each group of limb key points comprises:
determining a weight value of each historical video frame according to a generation time of each historical video frame, wherein the weight value is inversely proportional to the generation time; and
obtaining an intermediate value by computing a product of key point coordinates of historical limb key points of each historical video frame and the corresponding weight value, and obtaining the to-be-processed key point by accumulating at least one intermediate value.
17 . The electronic device of claim 14 , wherein the preset effect parameters comprise an effect strip display length, and obtaining the historical effect key points of the at least one historical video frame according to the preset effect parameters comprises:
obtaining, according to the effect strip display length, the historical effect key points of at least one historical frame preceding the current video frame.
18 . A non-transitory storage medium having computer executable instructions which, when executed by a computer processor, are configured to execute operations comprising:
determining at least one target limb key point of a current video frame;
determining at least one current effect key point according to the at least one target limb key point and historical limb key points of at least one historical video frame adjacent to the current video frame;
obtaining historical effect key points of the at least one historical video frame according to preset effect parameters, and determining, according to the at least one current effect key point and the historical effect key points, at least one group of target effects matching the preset effect parameters; and
determining a target video frame corresponding to the current video frame based on the at least one group of target effects,
wherein determining the at least one current effect key point according to the at least one target limb key point and the historical limb key points of at least one historical video frame adjacent to the current video frame comprises:
determining a plurality of limb key points belonging to a same part as a group of limb key points, wherein the group of limb key points comprises at least one of the target limb key point and the historical limb key points,
for each group of limb key points of a plurality of groups of limb key points, determining a to-be-processed key point according to weight values and corresponding key point coordinates of historical limb key points in each group of limb key points, and
determining at least one current effect key point corresponding to each group of limb key points according to the to-be-processed key point corresponding to each set of key points and a corresponding target key point.
19 . The non-transitory storage medium of claim 18 , wherein determining the to-be-processed key point according to the weight values and the corresponding key point coordinates of the historical limb key points in each group of limb key points comprises:
determining a weight value of each historical video frame according to a generation time of each historical video frame, wherein the weight value is inversely proportional to the generation time; and
obtaining an intermediate value by computing a product of key point coordinates of historical limb key points of each historical video frame and the corresponding weight value, and obtaining the to-be-processed key point by accumulating at least one intermediate value.
20 . The non-transitory storage medium of claim 18 , wherein the preset effect parameters comprise an effect strip display length, and obtaining the historical effect key points of the at least one historical video frame according to the preset effect parameters comprises:
obtaining, according to the effect strip display length, the historical effect key points of at least one historical frame preceding the current video frame.