Method, and apparatus, device, and storage medium for generating effect image
View Patent ↗Examples of the disclosure disclose a method and apparatus for generating an effect image, a device, and a storage medium. The method includes: acquiring a character appearance image to be morphed, and a first morphing point in the character appearance image to be morphed; acquiring a second morphing point in a character appearance template; determining a target morphing point according to the second morphing point and the first morphing point; and generating a character appearance morphing effect image based on the target morphing point.
1 . A method for generating an effect image, comprising:
acquiring a character appearance image to be morphed, and a first morphing point in the character appearance image to be morphed;
acquiring a second morphing point in a character appearance template;
determining a target morphing point according to the second morphing point and the first morphing point;
generating a character appearance morphing effect image based on the target morphing point;
wherein after the target morphing point is obtained, the method further comprises:
constructing an ellipse of a set size by using the first morphing point as a center;
obtaining a point of intersection of a connection line connecting the first morphing point and the target morphing point with the ellipse to determine the point of intersection as a final target morphing point in response to determining that the target morphing point falls outside the ellipse; and
retaining the target morphing point in response to determining that the target morphing point falls within the ellipse.
2 . The method of claim 1 , wherein acquiring a character appearance image to be morphed comprises:
scanning an image in a picture according to a set scanning mode in a process of acquiring a character appearance image; and
performing frame hold on a scanned area until the entire picture is scanned to obtain the character appearance image to be morphed.
3 . The method of claim 2 , wherein performing frame hold on a scanned area comprises:
traversing set key points of a character appearance in a picture for a scanned current frame;
determining whether the traversed set key point is fixed for the traversed set key point;
determining whether the traversed set key point is within the scanned area based on a determination result that the traversed set key point is not fixed; and
fixing the traversed set key point based on a determination result that the traversed set key point is within the scanned area.
4 . The method of claim 2 , wherein the set scanning mode comprises scanning with one or more of scanning lines; and
scanning an image in a picture in a set scanning mode comprises:
controlling, in response to determining the scanning with one scanning line, the one scanning line to scan the image in the picture in a set direction; and
determining, in response to determining the scanning with a plurality of scanning lines, a sub-area scanned by each scanning line to control the plurality of scanning lines to scan the image in the picture in a set direction and within corresponding sub-areas.
5 . The method of claim 1 , wherein determining a target morphing point according to the second morphing point and the first morphing point comprises:
generating a virtual standard character appearance according to character appearance information of the character appearance image to be morphed and the character appearance template;
determining a third morphing point in the virtual standard character appearance; and
determining the target morphing point according to the first morphing point, the second morphing point and the third morphing point.
6 . The method of claim 5 , wherein the character appearance information comprises a first eye distance and a first central key point; and generating a virtual standard character appearance according to character appearance information of the character appearance image to be morphed and the character appearance template comprises:
aligning a second central key point in the character appearance template with the first central key point; and
adjusting aligned eye distance in the person appearance template according to the first eye distance to obtain the virtual standard person appearance.
7 . The method of claim 6 , wherein determining a third morphing point in the virtual standard character appearance comprises:
determining the third morphing point according to the first central key point, the second central key point, the second morphing point, the first eye distance, and the eye distance in the character appearance template.
8 . The method of claim 6 , wherein determining the target morphing point according to the first morphing point, the second morphing point and the third morphing point comprises:
determining target morphing point according to the first morphing point, the second morphing point, the third morphing point, the first eye distance, and the eye distance in the character appearance template.
9 . An electronic device, comprising:
one or more processors; and a memory configured to store one or more programs which, when executed by the one or more processors, cause the one or more processors to implement operations, the operations comprising:
acquiring a character appearance image to be morphed, and a first morphing point in the character appearance image to be morphed;
acquiring a second morphing point in a character appearance template;
determining a target morphing point according to the second morphing point and the first morphing point;
generating a character appearance morphing effect image based on the target morphing point;
wherein after the target morphing point is obtained, the operations further comprise:
constructing an ellipse of a set size by using the first morphing point as a center;
obtaining a point of intersection of a connection line connecting the first morphing point and the target morphing point with the ellipse to determine the point of intersection as a final target morphing point in response to determining that the target morphing point falls outside the ellipse; and
retaining the target morphing point in response to determining that the target morphing point falls within the ellipse.
10 . The electronic device of claim 9 , wherein acquiring a character appearance image to be morphed comprises:
scanning an image in a picture according to a set scanning mode in a process of acquiring a character appearance image; and
performing frame hold on a scanned area until the entire picture is scanned to obtain the character appearance image to be morphed.
11 . The electronic device of claim 10 , wherein performing frame hold on a scanned area comprises:
traversing set key points of a character appearance in a picture for a scanned current frame;
determining whether the traversed set key point is fixed for the traversed set key point;
determining whether the traversed set key point is within the scanned area based on a determination result that the traversed set key point is not fixed; and
fixing the traversed set key point based on a determination result that the traversed set key point is within the scanned area.
12 . The electronic device of claim 10 , wherein the set scanning mode comprises scanning with one or more of scanning lines; and
scanning an image in a picture in a set scanning mode comprises:
controlling, in response to determining the scanning with one scanning line, the one scanning line to scan the image in the picture in a set direction; and
determining, in response to determining the scanning with a plurality of scanning lines, a sub-area scanned by each scanning line to control the plurality of scanning lines to scan the image in the picture in a set direction and within corresponding sub-areas.
13 . The electronic device of claim 9 , wherein determining a target morphing point according to the second morphing point and the first morphing point comprises:
generating a virtual standard character appearance according to character appearance information of the character appearance image to be morphed and the character appearance template;
determining a third morphing point in the virtual standard character appearance; and
determining the target morphing point according to the first morphing point, the second morphing point and the third morphing point.
14 . The electronic device of claim 13 , wherein the character appearance information comprises a first eye distance and a first central key point; and generating a virtual standard character appearance according to character appearance information of the character appearance image to be morphed and the character appearance template comprises:
aligning a second central key point in the character appearance template with the first central key point; and
adjusting aligned eye distance in the person appearance template according to the first eye distance to obtain the virtual standard person appearance.
15 . The electronic device of claim 14 , wherein determining a third morphing point in the virtual standard character appearance comprises:
determining the third morphing point according to the first central key point, the second central key point, the second morphing point, the first eye distance, and the eye distance in the character appearance template.
16 . The electronic device of claim 15 , wherein determining the target morphing point according to the first morphing point, the second morphing point and the third morphing point comprises:
determining target morphing point according to the first morphing point, the second morphing point, the third morphing point, the first eye distance, and the eye distance in the character appearance template.
17 . A non-transitory computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor implements operations, the operations comprising:
acquiring a character appearance image to be morphed, and a first morphing point in the character appearance image to be morphed;
acquiring a second morphing point in a character appearance template;
determining a target morphing point according to the second morphing point and the first morphing point;
generating a character appearance morphing effect image based on the target morphing point;
wherein after the target morphing point is obtained, the operations further comprise:
constructing an ellipse of a set size by using the first morphing point as a center;
obtaining a point of intersection of a connection line connecting the first morphing point and the target morphing point with the ellipse to determine the point of intersection as a final target morphing point in response to determining that the target morphing point falls outside the ellipse; and
retaining the target morphing point in response to determining that the target morphing point falls within the ellipse.
18 . The non-transitory computer-readable storage medium of claim 17 , wherein acquiring a character appearance image to be morphed comprises:
scanning an image in a picture according to a set scanning mode in a process of acquiring a character appearance image; and
performing frame hold on a scanned area until the entire picture is scanned to obtain the character appearance image to be morphed.
19 . The non-transitory computer-readable storage medium of claim 17 , wherein determining a target morphing point according to the second morphing point and the first morphing point comprises:
generating a virtual standard character appearance according to character appearance information of the character appearance image to be morphed and the character appearance template;
determining a third morphing point in the virtual standard character appearance; and
determining the target morphing point according to the first morphing point, the second morphing point and the third morphing point.
20 . The non-transitory computer-readable storage medium of claim 19 , wherein the character appearance information comprises a first eye distance and a first central key point; and generating the virtual standard character appearance according to character appearance information of the character appearance image to be morphed and the character appearance template comprises:
aligning a second central key point in the character appearance template with the first central key point; and
adjusting aligned eye distance in the person appearance template according to the first eye distance to obtain the virtual standard person appearance.