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

cameras.npz file #29

Closed
derrick-xwp opened this issue Dec 27, 2021 · 6 comments
Closed

cameras.npz file #29

derrick-xwp opened this issue Dec 27, 2021 · 6 comments

Comments

@derrick-xwp
Copy link

In order to run IDR on new data [DIR PATH], you need to supply image and mask directories, as well as cameras.npz file containing the appropriate camera projection matrices.

Dear authors,

Do we need to convert camera projection matrices in DTU dataset from txt to npy files?

Thanks

@teachyourselfcoding
Copy link

+1. Any chance of how to obtain the .npz file? Been searching around everywhere for a solution for this.

@lioryariv
Copy link
Owner

Hi,
Yes, the normalization code of the cameras is acting on cameras.npz file. For DTU, this npz file is a simple parsing of the txt files, meaning:

cameras = {}
n_cameras = 49 # or 64
scan_folder = 'DTU_preprocessed/scan65'
path_to_dtu_cameras = 'DTU/SampleSet/MVS Data/Calibration/cal18'
for i in range(n_cameras):
    filename = '{0}/pos_{1}.txt'.format(path_to_dtu_cameras, '%03d' % (i + 1))
    lines = open(filename).read().splitlines()
    lines = [[x[0], x[1], x[2], x[3]] for x in (x.split(" ") for x in lines)]
    P = np.asarray(lines).astype(np.float32).squeeze()
    P = np.concatenate([P, [[0, 0, 0, 1]]], 0)
    cameras['world_mat_%d' % i] = P
np.savez('{0}/cameras.npz'.format(scan_folder), **cameras)

And maybe you'll need to make this code compatible with your pathnames.

@derrick-xwp
Copy link
Author

Do we need to process the downloaded camera parameters in DTU dataset first before converting them to npz files?

@lioryariv
Copy link
Owner

As can be seen in the code in the previous comment, the only thing that needs to do to the camera parameters is to make them 4x4 instead of 3x4.

@teachyourselfcoding
Copy link

Hi, thank you for your work. Currently, I have these three files: cameras.bin/txt, cameras.bin/txt, poses3D.bin/txt. These 3 files contain all the data for my images. It seems from your previous reply that you are using individual.txt file for each image (/pos_{1}.txt'), can you provide me with any advice on how to obtain cameras.npz file? Thanks for you time~!

@siyangbing
Copy link

嗨,谢谢你的工作。目前,我有这三个文件:cameras.bin/txt、cameras.bin/txt、poses3D.bin/txt。这 3 个文件包含我的图像的所有数据。从您之前的回复看来,您对每张图片都使用了 individual.txt 文件(/pos_{1}.txt'),您能给我提供有关如何获取 camera.npz 文件的任何建议吗?谢谢你的时间~!

I have the same question , can you help me

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