前言

AnimatedDrawings是一款用于将手绘图形动画化的工具。下面将介绍如何安装和使用该工具。

正文

一、如何安装和使用AnimatedDrawings

安装步骤

  1. 安装Miniconda
    在安装AnimatedDrawings之前,需要先安装Miniconda或Anaconda。可以按照官网的指南下载并安装。

  2. 创建虚拟环境并安装AnimatedDrawings
    在终端中执行以下命令:

1
2
3
4
5
conda create --name animated_drawings python=3.8.13
conda activate animated_drawings
git clone https://github.com/facebookresearch/AnimatedDrawings.git
cd AnimatedDrawings
pip install -e .

使用步骤

  1. 运行Python解释器
    在终端中执行以下命令:
1
python
  1. 导入AnimatedDrawings
    在Python解释器中执行以下命令:
1
from animated_drawings import render
  1. 生成动画
1
render.start('./examples/config/mvc/interactive_window_example.yaml')

interactive_window_example

其他功能

  1. 生成MP4视频
1
render.start('./examples/config/mvc/export_mp4_example.yaml')
  1. 导出透明背景GIF
1
render.start('./examples/config/mvc/export_gif_alpha_example.yaml')

二、如何让自己的手绘画里的任务动起来

需要制作人物的annotations信息,制作过程如下:

使用TorchServe能够帮助生成动画,需要使用Docker容器来运行:

1
2
3
4
5
git clone https://github.com/facebookresearch/AnimatedDrawings.git 
cd AnimatedDrawings
cd torchserve
docker build -t docker_torchserve .
docker run -d --name docker_torchserve -p 8080:8080 -p 8081:8081 docker_torchserve

这将启动一个Docker容器,用于生成手绘图形的姿态估计文件。

根据生成的姿态估计文件制作动画效果,一行命令版:

1
cd ../examples && python image_to_animation.py drawings/jerry.png jerry_out
garlic garlic

如果姿态估计不正确,可以运行 python fix_annotations.py启动 Web 界面以可视化的方式手动修改 annotations,更新后执行python annotations_to_animation.py jerry_out

目前为止都是一个拟人的对象动画制作,如果有多个对象,想要添加不同背景或者画的是个大怪兽,有好几个触手咋办?放心,项目里都给出了相关配置文件,都在目录examples/config/mvc下,可以根据配合配置文件进行修改。

三、如何自定义不同的动作效果

需要制作BVH文件,基本步骤如下:

  1. 用摄像头录下自己手舞足蹈的过程。
  2. 使用Rokoko从录像中导出BVH(需要配戴设备,捕捉动作姿态)。
  3. 创建一个新的motion config fileretarget config file以适应Rokoko导出的骨架。
  4. 使用AnimatedDrawings完成手绘图形的动画效果。

项目示例的制作命令如下:

1
2
from animated_drawings import render
render.start('./examples/config/mvc/rokoko_motion_example.yaml')
video-zowbee

四、总结

AnimatedDrawings一款非常有趣和实用的工具,就像神笔马良一样,赋予笔下的人物和飞禽走兽生命。

最后

参考文章

AnimatedDrawings官方项目

声明

本文仅作为个人研究学习记录。

本文永久记录于区块链博客xlog