Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blender 数据集预处理 #24

Open
lovejoker1102 opened this issue Aug 5, 2024 · 5 comments
Open

blender 数据集预处理 #24

lovejoker1102 opened this issue Aug 5, 2024 · 5 comments

Comments

@lovejoker1102
Copy link

请问 blender 是要自己先去跑一遍 colmap 稀疏重建之后再跑 colmap_blender这个脚本吗

@jiaw-z
Copy link
Owner

jiaw-z commented Aug 5, 2024

这个是不用的,colmap_blender.py用的是数据集提供的transforms_train.json,所以先将里面的相机参数转换为colmap格式进行稠密重建

@lovejoker1102
Copy link
Author

是需要先对数据的格式进行处理吗,我用原本的 nerf_synthetic数据集的格式会报错:
cameras, images, points3D files do not exist at ../sparse/0/
*** Check failure stack trace: ***
@ 0x7fc1ec7d31c3 google::LogMessage::Fail()
@ 0x7fc1ec7d825b google::LogMessage::SendToLog()
@ 0x7fc1ec7d2ebf google::LogMessage::Flush()
@ 0x7fc1ec7d36ef google::LogMessageFatal::~LogMessageFatal()
@ 0x5610c48a74a7 colmap::Reconstruction::Read()
@ 0x5610c47de634 colmap::RunModelConverter()
@ 0x5610c47afc42 main
@ 0x7fc1ea380083 __libc_start_main
@ 0x5610c47b9ede _start
Aborted (core dumped)
train_img_list is ['r_2.png', 'r_16.png', 'r_26.png', 'r_55.png', 'r_73.png', 'r_76.png', 'r_86.png', 'r_93.png']
cp: cannot stat '../images/r_2.png': No such file or directory
cp: cannot stat '../images/r_16.png': No such file or directory
cp: cannot stat '../images/r_26.png': No such file or directory
cp: cannot stat '../images/r_55.png': No such file or directory
cp: cannot stat '../images/r_73.png': No such file or directory
cp: cannot stat '../images/r_76.png': No such file or directory
cp: cannot stat '../images/r_86.png': No such file or directory
cp: cannot stat '../images/r_93.png': No such file or directory
cp: cannot stat '../blender2colmap/sparse/cameras.txt': No such file or directory
feature load

@jiaw-z
Copy link
Owner

jiaw-z commented Aug 12, 2024

我进行了数据预处理,目的是用transform提供的pose进行mvs重建提供初始化。首先将train文件夹复制一份并重命名为images,之后的操作可以参考这个代码。

import numpy as np
import json
import os
import imageio
import math

H = 800
W = 800

blender2opencv = np.array([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
fnames = list(sorted(os.listdir('images')))
fname2pose = {}

with open('transforms_train.json', 'r') as f:
meta = json.load(f)

fx = 0.5 * W / np.tan(0.5 * meta['camera_angle_x']) # original focal length
if 'camera_angle_y' in meta:
fy = 0.5 * H / np.tan(0.5 * meta['camera_angle_y']) # original focal length
else:
fy = fx
if 'cx' in meta:
cx, cy = meta['cx'], meta['cy']
else:
cx = 0.5 * W
cy = 0.5 * H
with open('blender2colmap/sparse/cameras.txt', 'w') as f:
f.write(f'1 PINHOLE {W} {H} {fx} {fy} {cx} {cy}')

with open('blender2colmap/sparse/points3D.txt', 'w') as f:
f.write('')

@GOTA404
Copy link

GOTA404 commented Sep 11, 2024

按照以上思路,我处理的数据是nerf_synthetic/ficus,预处理过程中出现特征匹配数为0的问题。

按照以上思路我处理的数据是nerf_synthetic/ficus预处理过程中出现特征匹配数为0的问题I0911 22:18:03.654870 65094 feature_extraction.cc:257] Processed file [1/8]
I0911 22:18:03.654948 65094 feature_extraction.cc:260]   Name:            r_26.png
I0911 22:18:03.654960 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:03.654968 65094 feature_extraction.cc:289]   Camera:          #3 - SIMPLE_RADIAL
I0911 22:18:03.654989 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:03.655023 65094 feature_extraction.cc:296]   Features:        1112
I0911 22:18:03.782374 65094 feature_extraction.cc:257] Processed file [2/8]
I0911 22:18:03.782411 65094 feature_extraction.cc:260]   Name:            r_2.png
I0911 22:18:03.782423 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:03.782431 65094 feature_extraction.cc:289]   Camera:          #2 - SIMPLE_RADIAL
I0911 22:18:03.782441 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:03.782464 65094 feature_extraction.cc:296]   Features:        1282
I0911 22:18:03.804888 65094 feature_extraction.cc:257] Processed file [3/8]
I0911 22:18:03.804924 65094 feature_extraction.cc:260]   Name:            r_55.png
I0911 22:18:03.804934 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:03.804944 65094 feature_extraction.cc:289]   Camera:          #4 - SIMPLE_RADIAL
I0911 22:18:03.804952 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:03.804977 65094 feature_extraction.cc:296]   Features:        1146
I0911 22:18:03.822587 65094 feature_extraction.cc:257] Processed file [4/8]
I0911 22:18:03.822623 65094 feature_extraction.cc:260]   Name:            r_76.png
I0911 22:18:03.822634 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:03.822643 65094 feature_extraction.cc:289]   Camera:          #6 - SIMPLE_RADIAL
I0911 22:18:03.822652 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:03.822675 65094 feature_extraction.cc:296]   Features:        1176
I0911 22:18:03.823763 65094 feature_extraction.cc:257] Processed file [5/8]
I0911 22:18:03.823786 65094 feature_extraction.cc:260]   Name:            r_16.png
I0911 22:18:03.823796 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:03.823812 65094 feature_extraction.cc:289]   Camera:          #1 - SIMPLE_RADIAL
I0911 22:18:03.823820 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:03.823843 65094 feature_extraction.cc:296]   Features:        1200
I0911 22:18:03.984004 65094 feature_extraction.cc:257] Processed file [6/8]
I0911 22:18:03.984071 65094 feature_extraction.cc:260]   Name:            r_93.png
I0911 22:18:03.984082 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:03.984090 65094 feature_extraction.cc:289]   Camera:          #8 - SIMPLE_RADIAL
I0911 22:18:03.984100 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:03.984117 65094 feature_extraction.cc:296]   Features:        1390
I0911 22:18:03.992869 65094 feature_extraction.cc:257] Processed file [7/8]
I0911 22:18:03.992905 65094 feature_extraction.cc:260]   Name:            r_86.png
I0911 22:18:03.992916 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:03.992925 65094 feature_extraction.cc:289]   Camera:          #7 - SIMPLE_RADIAL
I0911 22:18:03.992934 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:03.992964 65094 feature_extraction.cc:296]   Features:        1363
I0911 22:18:04.002305 65094 feature_extraction.cc:257] Processed file [8/8]
I0911 22:18:04.002350 65094 feature_extraction.cc:260]   Name:            r_73.png
I0911 22:18:04.002362 65094 feature_extraction.cc:286]   Dimensions:      800 x 800
I0911 22:18:04.002378 65094 feature_extraction.cc:289]   Camera:          #5 - SIMPLE_RADIAL
I0911 22:18:04.002391 65094 feature_extraction.cc:292]   Focal Length:    960.00px
I0911 22:18:04.002416 65094 feature_extraction.cc:296]   Features:        1387
I0911 22:18:04.004369 64965 timer.cc:91] Elapsed time: 0.031 [minutes]
feature load
I0911 22:18:04.198740 65167 misc.cc:198] 
==============================================================================
Feature matching
==============================================================================
I0911 22:18:04.199151 65168 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:04.199249 65169 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:04.199357 65170 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:04.199465 65172 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:04.206179 65240 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:04.206190 65238 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:04.206271 65241 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:04.206228 65239 sift.cc:1451] Creating SIFT GPU feature matcher
I0911 22:18:05.409224 65167 pairing.cc:168] Generating exhaustive image pairs...
I0911 22:18:05.409293 65167 pairing.cc:202] Matching block [1/1, 1/1]
I0911 22:18:05.416702 65167 feature_matching.cc:46]  in 0.007s
I0911 22:18:05.416812 65167 timer.cc:91] Elapsed time: 0.020 [minutes]
['r_26.png', 'r_2.png', 'r_55.png', 'r_76.png', 'r_16.png', 'r_93.png', 'r_86.png', 'r_73.png'] 
r_26.png
r_2.png
r_55.png
r_76.png
r_16.png
r_93.png
r_86.png
r_73.png
I0911 22:18:05.599144 65250 misc.cc:198] 
==============================================================================
Loading model
==============================================================================
I0911 22:18:05.606726 65250 incremental_mapper.cc:225] Loading database
I0911 22:18:05.608363 65250 database_cache.cc:65] Loading cameras...
I0911 22:18:05.608444 65250 database_cache.cc:75]  8 in 0.000s
I0911 22:18:05.608472 65250 database_cache.cc:83] Loading matches...
I0911 22:18:05.608510 65250 database_cache.cc:89]  0 in 0.000s
I0911 22:18:05.608529 65250 database_cache.cc:105] Loading images...
I0911 22:18:05.608608 65250 database_cache.cc:155]  8 in 0.000s (connected 0)
I0911 22:18:05.608634 65250 database_cache.cc:166] Building correspondence graph...
I0911 22:18:05.608650 65250 database_cache.cc:195]  in 0.000s (ignored 0)
I0911 22:18:05.608664 65250 timer.cc:91] Elapsed time: 0.000 [minutes]
W0911 22:18:05.608683 65250 incremental_mapper.cc:247] No images with matches found in the database
E0911 22:18:05.608915 65250 incremental_mapper.cc:542] Check failed: LoadDatabase() 
terminate called after throwing an instance of 'std::invalid_argument'
  what():  [incremental_mapper.cc:542] Check failed: LoadDatabase() 
*** Aborted at 1726064285 (unix time) try "date -d @1726064285" if you are using GNU date ***
PC: @     0x7ff9a222f8eb gsignal
*** SIGABRT (@0x3e80000fee2) received by PID 65250 (TID 0x7ff9827b4000) from PID 65250; stack trace: ***
    @     0x7ff9cd7c3730 (unknown)
    @     0x7ff9a222f8eb gsignal
    @     0x7ff9a221a535 abort
    @     0x7ff9a27fe646 (unknown)
    @     0x7ff9a280ff06 (unknown)
    @     0x7ff9a280ff71 std::terminate()
    @     0x7ff9a28101b4 __cxa_throw
    @     0x560d7f31027c (unknown)
    @     0x560d7f36dd19 (unknown)
    @     0x560d7f36e28d (unknown)
    @     0x560d7f35117b (unknown)
    @     0x7ff9a221c09b __libc_start_main
    @     0x560d7f357f9a (unknown)
Aborted (core dumped)
E0911 22:18:05.808089 65316 reconstruction.cc:539] cameras, images, points3D files do not exist at triangulated
terminate called after throwing an instance of 'std::invalid_argument'
  what():  [reconstruction.cc:539] cameras, images, points3D files do not exist at triangulated
*** Aborted at 1726064285 (unix time) try "date -d @1726064285" if you are using GNU date ***
PC: @     0x7f81c55c98eb gsignal
*** SIGABRT (@0x3e80000ff24) received by PID 65316 (TID 0x7f81a5b4e000) from PID 65316; stack trace: ***
    @     0x7f81f0b5d730 (unknown)
    @     0x7f81c55c98eb gsignal
    @     0x7f81c55b4535 abort
    @     0x7f81c5b98646 (unknown)
    @     0x7f81c5ba9f06 (unknown)
    @     0x7f81c5ba9f71 std::terminate()
    @     0x7f81c5baa1b4 __cxa_throw
    @     0x55e0dc56ef2b (unknown)
    @     0x55e0dc5ecb08 (unknown)
    @     0x55e0dc5a817b (unknown)
    @     0x7f81c55b609b __libc_start_main
    @     0x55e0dc5aef9a (unknown)
Aborted (core dumped)
I0911 22:18:06.008960 65382 misc.cc:198] 
==============================================================================

@shaonian123daly
Copy link

你好,请问你解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants