当前位置:网站首页>I drew a Gu ailing with characters!
I drew a Gu ailing with characters!
2022-07-27 08:15:00 【51CTO】
Before, I often saw that kind of video composed of characters on the Internet , Very cool . I don't know how to do it , I've studied these two days , It's not hard to find .
Let's take a look at the final effect ( If vague , Click the link below to see the HD version ):
https://bytedance.feishu.cn/docx/doxcnCvvY051xFCBAmSqYZgiP7b
How to achieve ?
Simply speaking , To turn a color video into a black-and-white video drawn by characters , You can do it in the following steps :
- Frame the original video , Black and white every frame , And the pixels are represented by corresponding characters .
- Recombine the represented string into a character image .
- Combine all the character images into character video .
- Import the audio of the original video into the new character video .
Operation method
I put the complete code at the end of the article , Direct operation python3 video2char.py that will do . The program will ask you to enter the local path of the video and the definition after the transformation (0 Most blurred ,1 The clearest . Of course, the clearer , The slower the transition ).
To run the code, you need to use tqdm、opencv_python、moviepy Wait for a few libraries , First of all pip3 install Make sure they all have .
Principle analysis
The key step is how to convert a color image into a black-and-white character image , As shown in the figure below :

Extracted from the Frog Princess video

Drawn in characters
The principle of transformation is actually very simple . First of all, because a character will occupy a large pixel block in the image , So we must compress the color image first , Successive blocks of pixels can be merged , This compression process is opencv Of resize operation .
Then convert the compressed pixels into black-and-white pixels , And transform it into the corresponding character . Character, I use the following string here , From black to white , After my practice, this group is the best :
"#8XOHLTI)i=+;:,. "
Then you need to paint the transformed characters on the new canvas , It should be noted that the layout is uniform and compact , It's best not to have too much extra space around the canvas .
Finally, combine all the character images into a video , But there is no sound after the merger , Need to use moviepy The library imports the sound of the original video .
Complete code
边栏推荐
- vCenter7.0管理Esxi7.0主机
- How to play with the purchase of SAP variant materials? Look at this article and you will understand
- File name wildcard rules for kettle
- Five day travels to Beijing
- Dirsearch[directory scanning tool]
- Shenzhi Kalan Temple
- [applet] how to get wechat applet code upload key?
- Shell scripts related
- 2022/7/26 exam summary
- Vcenter7.0 installation of ibm3650m4 physical machine
猜你喜欢

Data extraction 2

数据提取1

Stored procedures and functions

Sword finger offer 58 - I. flip word order

Attack and defense world MFW

How to obtain the cash flow data of advertising services to help analyze the advertising effect?

Virtual machine cloning

idea远程调试

"PHP Basics" uses echo statements to output information

Download and usage of sequel Pro
随机推荐
2022-07-26 group 4 abstract classes and interfaces
Dasctf2022.07 enabling game password WP
C language: optimized Hill sort
Opengauss stopped from the library and found that the main library could not write data
帮忙发几个招聘,有兴趣可以看看
vCenter7.0管理Esxi7.0主机
The dragon lizard exhibition area plays a new trick this time. Let's see whose DNA moved?
DEMO:ST05 找文本ID 信息
ERP生产作业控制 华夏
Graph node deployment and testing
Methods of server network testing
How to analyze and locate problems in 60 seconds?
1178 questions of Olympiad in informatics -- ranking of grades
Combined use of C WinForm form form event and delegate
Harbor can't log in with the correct password
"PHP Basics" uses echo statements to output information
Debug: generic related "unresolved external symbols"
"PHP Basics" tags in PHP
Qt Creator代码风格插件Beautifier
[geek challenge 2019] finalsql 1