banner
hughie

hughie

热爱技术的小菜鸟, 记录一下所学所感

神笔马良来啦-记录AnimatedDrawings安装与使用

前言#

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

正文#

一、如何安装和使用 AnimatedDrawings#

安装步骤

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

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

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

interactive_window_example.gif

其他功能

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

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

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

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

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 容器,用于生成手绘图形的姿态估计文件。

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

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

jerry.png

jerry.gif

如果姿态估计不正确,可以运行 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 完成手绘图形的动画效果。

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

from animated_drawings import render
render.start('./examples/config/mvc/rokoko_motion_example.yaml')

video-zowbee.gif

四、总结#

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

最后#

参考文章#

AnimatedDrawings 官方项目

声明#

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

本文与HBlog保持同步。

加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。