In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to use python code to make character drawing version of duckling emoji package, I believe that many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Some time ago, a lovely little yellow duck became popular. It is said that a little sister in yellow clothes imitated the movements of the little yellow duck on Douyin and became popular. This cute little yellow duck meme has also become popular, and the little yellow duck emoji has changed from one to more, and the color is also unpredictable.
As a qualified programmer, how can we lag behind? we have to make a duckling that conforms to the programmer's logo. We turn the dynamic diagram of the duckling into a character-based dynamic diagram of the duckling. Directly above, an original picture of the duckling, a character type of the programmer's logo. Ps: character drawing may be more effective from a distance!
How do you do this program? Don't worry, I'll give you an analysis of how to implement this program.
Procedure steps
It only takes 3 steps to realize the transformation of character dynamic graph, which must be divided and merged for a long time.
Split the original dynamic map into frame-by-frame pictures.
Convert each split picture into a character painting.
Combine the pictures of each frame of characters into a dynamic picture.
Program environment
Language: Python 3.6
Editor: Pycharm
Third-party library installation
Before running the program, we need to install two important libraries, the first is Imageio, which is a Python library, which provides a simple interface to read and write all kinds of image data, including animated images, volume data and scientific formats. It is cross-platform, runs on Python 2.7and 3.4 +, and is easy to install.
Use the pip command to quickly install, due to work needs, my computer installed Python2.7 and Python3.6 two versions, I use numbers to distinguish between different versions, if your computer installed only one version, you can remove the previous python3-m command, directly use the command behind pip.
Python3-m pip install imageio
The second library that needs to be installed is the opencv-python library, a cross-platform computer visual library released under the BSD license (open source) that can run on Linux, Windows, and MacOS operating systems. It is lightweight and efficient-it consists of a series of C functions and a small number of C++ classes, provides interfaces to Python, Ruby, MATLAB and other languages, and implements many general algorithms in image processing and computer vision. In short, the editing of computer images and videos can be realized through openCV. It is widely used in image recognition, motion tracking, machine vision and other fields.
Python3-m pip install opencv-python
Import Editor
Install the above two libraries in the editor Pycharm's settings/Interpreter and import them in the program. Explain that opencv-python this library only uses the cv2 module, so you only need to import this module.
Import imageio
Import cv2
Split picture
First define the save path of the original picture and the processed picture, before you run the program, you need to change the path of the picture you need to convert and the path and name of the converted character picture. Then the original dynamic graph is read by the mimread method in imageio, and each frame of the dynamic graph is divided into several pictures.
Convert to character painting
Apply the mapping between the grayscale and characters of the picture defined above, convert each picture above into a character picture, and save it in a list.
Serial characters are drawn as dynamic graphs.
Finally, the character drawing of each frame just processed is combined into a dynamic graph through the mimsave method in the imageio library, and becomes a character dynamic graph.
Imageio.mimsave (dealPic, A, 'GIF', duration=0.1) # combines the characters in the A list into dynamic diagrams
Print ('conversion completed, please check under your saved path')
Through this program, we can turn our favorite pictures into character drawing dynamic pictures.
After reading the above, have you mastered how to make a character drawing version of the duckling emoji package with python code? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.