Image processing method and apparatus, electronic device and readable storage medium
View Patent ↗Embodiments of the present disclosure provide an image processing method and apparatus, an electronic device, and a readable storage medium. The method includes: acquiring an image; detecting a target object in the image; performing, based on a posture of the target object, dancing effect rendering on the target object to generate an animation of the target object dancing; superimposing the animation on the image to obtain a dancing effect animation; and displaying the dancing effect animation. In the embodiment of the present disclosure, the object in the image can be rendered with a dancing effect to generate the animation of the object dancing.
1 . An image processing method, comprising:
acquiring an image;
detecting a target object in the image;
performing, based on a posture of the target object, dancing effect rendering on the target object to generate an animation of the target object dancing;
superimposing the animation on the image to obtain a dancing effect animation; and
displaying the dancing effect animation;
wherein the performing, based on the posture of the target object, the dancing effect rendering on the target object to generate the animation of the target object dancing comprises:
determining a driving part of the target object based on the posture of the target object; and
driving the driving part to drive other parts of the target object to dance, to generate the animation;
wherein the driving part comprises a part with a smallest ordinate among pixel blocks of the target object.
2 . The method according to claim 1 , wherein the detecting the target object in the image comprises:
detecting a candidate object in the image; and
determining the target object from the candidate object.
3 . The method according to claim 2 , wherein the image includes at least two candidate objects, and the determining the target object from the candidate object comprises:
determining the at least two candidate objects as the target object; or,
acquiring a candidate target object from the at least two candidate objects, and determining the candidate target object as the target object.
4 . The method according to claim 3 , wherein the acquiring the candidate target object from the at least two candidate objects comprises:
acquiring an area ratio of each candidate object of the at least two candidate objects; and
determining the candidate object with a largest area ratio as the candidate target object.
5 . The method according to claim 3 , wherein the acquiring the candidate target object from the at least two candidate objects comprises:
determining a candidate object at a preset position as the candidate target object.
6 . The method according to claim 1 , wherein before superimposing the animation on the image, the method comprises:
performing blurring processing on the target object in the image;
the superimposing the animation on the image comprises:
superimposing the animation on a pixel block region corresponding to the target object that has been subjected to the blurring processing.
7 . The method according to claim 6 , wherein the performing blurring processing on the target object in the image comprises:
segmenting out the pixel block region corresponding to the target object in the image;
acquiring a circumscribed polygon of the pixel block region; and
performing blurring processing on a pixel block within the polygon.
8 . The method according to claim 1 , wherein the image is a frame of image in a video, and the superimposing the animation on the image comprises:
superimposing the animation on the frame of image and another frame of image in the video after the frame of image.
9 . The method according to claim 8 , wherein the superimposing the animation on the frame of image and the another frame of image in the video after the frame of image comprises:
superimposing the animation on a region corresponding to the target object in the frame of image and a region corresponding to the target object in the another frame of image after the frame of image.
10 . The method according to claim 8 , wherein after the detecting the target object in the image, the method further comprises:
displaying an identification on the image, wherein the identification is used to mark the target object.
11 . The method according to claim 10 , wherein the displaying the identification on the image comprises:
highlighting a contour line of the target object in the image.
12 . The method according to claim 10 , wherein after the displaying the identification on the image, the method further comprises:
displaying a countdown in the video, wherein the countdown is used to prompt that the dancing effect rendering is performed on the target object at the end of the countdown.
13 . The method according to claim 12 , wherein the performing, based on the posture of the target object, the dancing effect rendering on the target object comprises:
performing, based on a posture of the target object detected, the dancing effect rendering on the target object at the end of the countdown.
14 . The method according to claim 12 , further comprising:
in a case that the target object is not detected at the end of the countdown, continuing to detect the target object in the video.
15 . The method according to claim 1 , wherein the animation comprises: an animation of a planar target object dancing, or an animation of a three-dimensional target object dancing, or an augmented reality AR animation of the target object dancing.
16 . An image processing apparatus, comprising:
at least one processor; and
memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor and the instructions are executed by the at least one processor, so that the at least one processor is configured to:
acquire an image;
detect a target object in the image;
perform, based on a posture of the target object, dancing effect rendering on the target object to generate an animation of the target object dancing;
superimpose the animation on the image to obtain a dancing effect animation; and
display the dancing effect animation;
wherein the at least one processor is further configured to:
determine a driving part of the target object based on the posture of the target object; and
drive the driving part to drive other parts of the target object to dance, to generate the animation;
wherein the driving part comprises a part with a smallest ordinate among pixel blocks of the target object.
17 . The image processing apparatus according to claim 16 , wherein the at least one processor is configured to:
detect a candidate object in the image; and
determine the target object from the candidate object.
18 . The image processing apparatus according to claim 16 , wherein the image includes at least two candidate objects, and the at least one processor is configured to:
determine the at least two candidate objects as the target object; or,
acquire a candidate target object from the at least two candidate objects, and determine the candidate target object as the target object.
19 . A non-transitory computer-readable storage medium, wherein the computer-readable storage medium has computer-executable instructions stored thereon, and when a processor executes the computer-executable instructions, the processor executes steps of:
acquiring an image;
detecting a target object in the image;
performing, based on a posture of the target object, dancing effect rendering on the target object to generate an animation of the target object dancing;
superimposing the animation on the image to obtain a dancing effect animation; and
displaying the dancing effect animation;
wherein the performing, based on the posture of the target object, dancing effect rendering on the target object to generate the animation of the target object dancing comprises:
determining a driving part of the target object based on the posture of the target object; and
driving the driving part to drive other parts of the target object to dance, to generate the animation;
wherein the driving part comprises a part with a smallest ordinate among pixel blocks of the target object.