Introduction:
After work yesterday, I went home to have dinner and lay down directly. What can we do when we are bored?
Brush, of course — Douyin, uh-huh, and then reanimated a special effect from Douyin called “Transformation Comics,” which was almost too good to watch.
From stars to passers-by, it can be called the participation of the whole people. After watching a lot of similar videos, the effect is actually so good. Take a look at the effect
Enter Zhang Yixing and Qi Wei.
As you can see, the effect is based on the character’s face, which is nicely translated intoTwo-dimensional cartoonStyle.
Especially the treatment of the eyes, zhang Yixing’s lazy eyes, Qi Wei’s watery eyes, the interpretation of incisively and vividly.
Hairstyle of course also is “full mark conversion”, bifurcation, modelling and other details can be said to be a bit not bad.
Breakthrough “dimensional wall” key technology: today to discuss it, make a small animation program! Everyone is beautiful
The body of the
This article is the use of Baidu API portrait animation of small procedures ha!
Here first to provide you with the following a website, this is Baidu AI open platform on portrait animation website:
https://ai.baidu.com/tech/imageprocess/selfie_anime
Copy the code
Find API keys and Secret Keys:
First, search Baidu AI to enter the following interface:
It’s a little hard to see:
Step 1: Log in.
**
**
Step 2: Create.
The attached source code is as follows:
# encoding: utF-8 import requests import base64 Client_secret is SK host = obtained on the official website 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id= & website to obtain the AK 】 【 client_secret =' official website to obtain the SK 】 【 response = requests.get(host) if response: Access_token = response.json()["access_token"] access_token= response.json()["access_token"] Request_url = "https://aip.baidubce.com/rest/2.0/image-process/v1/selfie_anime" # binary way open to deal with image file f = open (" 001 JPG ", Img = base64encode (f.read()) params = {"image":img} request_url = request_url + "? Access_token =" + access_token headers = {'content-type': 'application/x-www-form-urlencoded'} response = requests.post(request_url, data=params, headers=headers) print(response) if response: # save file f = open('t.jpg', 'wb') img = (response.json()['image']) f.write(base64.b64decode(img)) f.close()Copy the code
The effect is as follows:
01 — Little sister and even scenery.
**
**
**
**
02 — Let’s have a nice shot from behind.
03 — It was amazing.
conclusion
Wonderful ah wonderful ah animation of small procedures, everything can – to try it? If you have a date, get on it
For complete project source code + source material base see: # private letter xiaobian 06# or click on the blue text to add you can get free benefits!
Your support is my biggest motivation!! Mua welcomes you to read previous articles