从零开始跑通3DGS教程:(一)数据(采集)

发布于:2025-03-29 ⋅ 阅读:(30) ⋅ 点赞:(0)

写在前面

  • 本文内容
    本文所属《从零开始跑通3DGS教程》系列文章;
    本文介绍数据准备或者采集准备方式

  • 平台/环境
    linux, nvidia GPU, docker

  • 转载请注明出处:
    https://blog.csdn.net/qq_41102371/article/details/146533367

系列文章

公开数据

下载官方给出的公开数据集
https://github.com/graphdeco-inria/gaussian-splatting?tab=readme-ov-file
在这里插入图片描述

将解压后的truck/images复制到YOUR_PATH/3dgs_tutorial/pro/truck/images在这里插入图片描述

在这里插入图片描述

自己的数据

使用手机或者相机采集视频,然后对视频进行抽帧,建议保留3-5帧/s即可。比如原始视频30fps,抽成3fps,那么就抽1/10,下面是抽帧的代码

import os
import cv2

video_path = "xxx/my_video.mp4"
print(video_path)
dir_save = "YOUR_PATH/3dgs_tutorial/pro/my_video/images"
if not os.path.exists(dir_save):
    os.makedirs(dir_save)
    
cap = cv2.VideoCapture(video_path)

if not cap.isOpened():
    print("Error: Could not open video.")
    exit()

frame_count = 0
save_count = 0

# read each frame
while True:
    ret, frame = cap.read()
    if not ret:
        print("Done extracting frames. End of video.")
        break
    if frame_count % 10 != 0:
        frame_count += 1
        continue

    # save frame
    cv2.imwrite(f"{dir_save}/{save_count}.jpg", frame)
    print(f"saved {save_count}")
    frame_count += 1
    save_count += 1

# release the VideoCapture object
cap.release()

参考

文中已列出

主要做激光/影像三维重建,3DGS,配准、分割等常用点云算法,熟悉open3d、pcl等开源点云库,技术交流、咨询可私信