Go to file
2025-02-15 16:49:10 +08:00
.cursor/rules Update 2025-02-15 14:31:02 +08:00
ext/diff_gaussian_rasterization_hair GaussianHaircut 2025-02-14 00:44:47 +08:00
src GaussianHaircut 2025-02-14 00:44:47 +08:00
.cursorignore Update 2025-02-14 01:00:32 +08:00
.gitattributes Update 2025-02-14 01:00:32 +08:00
.gitignore Update .gitignore 2025-02-15 15:56:18 +08:00
activate_gaussian_splatting_hair.bat Update 2025-02-14 02:15:09 +08:00
activate_matte_anything.bat Update 2025-02-14 02:15:09 +08:00
activate_openpose.bat Update 2025-02-14 02:15:09 +08:00
activate_pixie-env.bat Update 2025-02-14 02:15:09 +08:00
download_resource.bat Update download_resource.bat 2025-02-15 16:42:39 +08:00
environment.yml GaussianHaircut 2025-02-14 00:44:47 +08:00
install.bat Update 2025-02-15 14:46:18 +08:00
install.sh GaussianHaircut 2025-02-14 00:44:47 +08:00
LICENSE.md GaussianHaircut 2025-02-14 00:44:47 +08:00
micromamba.exe Update 2025-02-14 01:00:32 +08:00
README_CN.md Update 2025-02-15 16:49:10 +08:00
README.md Update 2025-02-15 16:49:10 +08:00
requirements.txt Update 2025-02-14 02:15:09 +08:00
run.bat Update 2025-02-15 14:46:18 +08:00
run.sh GaussianHaircut 2025-02-14 00:44:47 +08:00

Gaussian Haircut: Human Hair Reconstruction with Strand-Aligned 3D Gaussians

中文 | English

This repository contains the official implementation of Gaussian Haircut, a strand-based human hair reconstruction method from monocular video.

Paper | Project Page

Overview

The reconstruction process includes the following main stages:

  1. Preprocessing Stage

    • Video frame extraction and organization
    • COLMAP camera reconstruction
    • Hair and body segmentation
    • Image quality assessment and filtering
    • Orientation map calculation
    • Facial keypoint detection
    • FLAME head model fitting
  2. Reconstruction Stage

    • 3D Gaussian reconstruction
    • FLAME mesh fitting
    • Scene cropping and optimization
    • Hair strand reconstruction
  3. Visualization Stage

    • Export reconstructed strands
    • Blender rendering visualization
    • Generate result video

Expected output:

[your_scene_folder]/
├── raw.mp4                    # Input video
├── 3d_gaussian_splatting/     # 3D Gaussian reconstruction results
├── flame_fitting/             # FLAME head model fitting results
├── strands_reconstruction/    # Hair strand reconstruction intermediate results
├── curves_reconstruction/     # Final hair strand results
└── visualization/            # Rendering results and video

入门指南

Linux 平台

  1. 安装 CUDA 11.8

    按照 https://developer.nvidia.com/cuda-11-8-0-download-archive 上的说明进行操作。

    确保:

    • PATH 包含 <CUDA_DIR>/bin
    • LD_LIBRARY_PATH 包含 <CUDA_DIR>/lib64

    该环境仅在此 CUDA 版本下进行了测试。

  2. 安装 Blender 3.6 以创建股线可视化

    按照 https://www.blender.org/download/lts/3-6 上的说明进行操作。

  3. 克隆仓库并运行安装脚本

    git clone git@github.com:eth-ait/GaussianHaircut.git
    cd GaussianHaircut
    chmod +x ./install.sh
    ./install.sh
    

Windows 平台

  1. 安装 CUDA 11.8

  2. 安装 Blender 3.6

  3. 安装 Visual Studio 2019 Build Tools

  4. 安装 COLMAP

    • https://github.com/colmap/colmap/releases 下载并安装
    • 下载CUDA版本的COLMAP (例如COLMAP-3.8-windows-cuda.zip)
    • 解压到不含空格的路径 (例如C:\COLMAP)
    • 将COLMAP目录添加到系统PATH:
      1. 打开"系统属性" > "环境变量"
      2. 在"系统变量"中找到"Path"
      3. 点击"编辑" > "新建"
      4. 添加COLMAP目录路径
      5. 点击"确定"保存
    • 重启终端使PATH生效
  5. 安装 7-Zip

    • https://7-zip.org/ 下载并安装
    • 将7-Zip安装目录添加到系统PATH:
      1. 打开"系统属性" > "环境变量"
      2. 在"系统变量"中找到"Path"
      3. 点击"编辑" > "新建"
      4. 添加7-Zip安装目录(默认为C:\Program Files\7-Zip)
      5. 点击"确定"保存
    • 重启终端使PATH生效
  6. 下载预训练模型和资源

    git clone https://github.com/Jeffreytsai1004/GaussianHairCut
    cd GaussianHairCut
    # 在PowerShell中运行:
    # 脚本会自动安装gdown并下载所需资源
    .\download_resource.bat
    

    注意:

    • 下载过程可能需要几分钟到几十分钟,取决于网络速度
    • 如果下载失败,可以重新运行脚本
    • 确保有稳定的网络连接
  7. 克隆仓库并运行安装脚本

    git clone https://github.com/Jeffreytsai1004/GaussianHairCut
    cd GaussianHairCut
    # 先下载所需要的资源
    .\download_resource.bat
    # 运行安装脚本
    .\install.bat
    # 运行重建脚本
    .\run.bat
    

重建

  1. 录制单目视频

    • 参考项目页面上的示例视频
    • 录制要求:
      • 拍摄对象应缓慢转动头部,确保捕捉到所有角度
      • 保持头发和面部清晰可见
      • 避免快速移动导致的运动模糊
      • 保持光照条件稳定
      • 建议视频长度10-20秒
      • 建议分辨率1920x1080或更高
  2. 设置重建场景的目录

    创建场景目录结构:

    [your_scene_folder]/
    └── raw.mp4  # 您录制的视频文件
    

    注意:

    • DATA_PATH 应指向包含 raw.mp4 的目录
    • 目录路径不应包含空格或特殊字符
    • 脚本会在此目录下自动创建所需的子目录
    • 确保有足够的磁盘空间(建议至少20GB)
  3. 运行脚本

Linux:

export PROJECT_DIR="[/path/to/]GaussianHaircut"
export BLENDER_DIR="[/path/to/blender/folder/]blender"
DATA_PATH="[path/to/scene/folder]" ./run.sh

Windows:

# 在CMD中运行:
set PROJECT_DIR=[path\to\]GaussianHaircut
set DATA_PATH=[path\to\scene\folder]
run.bat

# 或在PowerShell中运行:
set PROJECT_DIR=[path\to\]GaussianHaircut
set DATA_PATH=[path\to\scene\folder]
.\run.bat

该脚本执行数据预处理、重建以及使用 Blender 进行最终可视化。使用 Tensorboard 查看中间可视化结果。

许可证

此代码基于 3D Gaussian Splatting 项目。有关条款和条件,请参阅 LICENSE_3DGS。其余代码根据 CC BY-NC-SA 4.0 分发。

如果此代码对您的项目有帮助,请引用以下论文。

引用

@inproceedings{zakharov2024gh,
   title = {Human Hair Reconstruction with Strand-Aligned 3D Gaussians},
   author = {Zakharov, Egor and Sklyarova, Vanessa and Black, Michael J and Nam, Giljoo and Thies, Justus and Hilliges, Otmar},
   booktitle = {European Conference of Computer Vision (ECCV)},
   year = {2024}
} 

链接