当前位置:网站首页>On Valentine's day, I drew an object with characters!
On Valentine's day, I drew an object with characters!
2022-07-27 08:14: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
边栏推荐
- How does kettle handle text data transfer as' 'instead of null
- How to update PIP3? And running PIP as the 'root' user can result in broken permissions and conflicting behavior
- Use of "PHP Basics" Boolean
- JS access cookie example
- I can't figure out why MySQL uses b+ trees for indexing?
- Combined use of C WinForm form form event and delegate
- Data extraction 1
- Redis configuration file download
- 【目标检测】YOLOv6理论解读+实践测试VisDrone数据集
- Data extraction 2
猜你喜欢

Comprehensive cases

SSTI template injection

File name wildcard rules for kettle
![[pytorch] resnet18, resnet20, resnet34, resnet50 network structure and Implementation](/img/44/52c7dc6871fd43223eadfd394e159e.png)
[pytorch] resnet18, resnet20, resnet34, resnet50 network structure and Implementation

Prevent cookies from modifying ID to cheat login
![[BJDCTF2020]EasySearch 1](/img/ea/90ac6eab32c28e09bb1fab62b6b140.png)
[BJDCTF2020]EasySearch 1

IBM3650M4实体机安装VCenter7.0

Combined use of C WinForm form form event and delegate

Things come to conform, the future is not welcome, at that time is not miscellaneous, neither love

Virtual machine cloning
随机推荐
[ciscn2019 southeast China division]web11 1
Solution to the program design of the sequence structure of one book (Chapter 1)
想让照片中的云飘起来?视频编辑服务一键动效3步就能实现
C language: random generated number + insertion sort
Shenzhi Kalan Temple
[netding cup 2020 rosefinch group]nmap 1 two solutions
PHP realizes data interaction with MySQL
Modification case of Ruixin micro rk3399-i2c4 mounting EEPROM
Virtual machine cloning
You may need an additional loader to handle the result of these loaders.
C commissioned use cases
[applet] the upload of the wechat applet issued by uniapp failed error: error: {'errcode': -10008,'errmsg':'Invalid IP
Opengauss stopped from the library and found that the main library could not write data
一文速览EMNLP 2020中的Transformer量化论文
File name wildcard rules for kettle
1024 | in the fourth year officially called Menon, the original intention is still there, and continue to move forward
Five day travels to Beijing
All in one 1353 -- expression bracket matching (stack)
QingChuang technology joined dragon lizard community to build a new ecosystem of intelligent operation and maintenance platform
The seta 2020 international academic conference will be held soon. Welcome to attend!