-
Notifications
You must be signed in to change notification settings - Fork 211
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_xxx.npz #125
Comments
How do I compute the scale matrix so the scene fits inside that sphere? Could you give me an example? Is there any code to obtain the scale matrices? |
Well, if you know the size of your scene, then the sphere radius should allow you to encompass it. The authors generally use scenes less than 2 metres in size, so they just use scale = 1. If you wanted to automate that, you would need to read the maximum distance between two points in your mesh and set the scale/2 to just above that by maybe 5% or so. Until you write that code, just set the scale to what it needs to be, like here: import numpy as np
experiment_name = input('enter folder name: ') +'/'
a = dict(np.load(experiment_name+'cameras_sphere.npz'))
print('base scale == 4')
print('current scale is ' + str(a['scale_mat_0'][0][0]))
c = int(input('enter new scale as integer: '))
new_scale = np.array(([c,0,0,0],
[0,c,0,0],
[0,0,c,0],
[0,0,0,1]),dtype = float)
scale_inv = np.linalg.inv(new_scale)
ns = 0
for i in a:
print(i)
if ns % 4 == 0:
a[i] = new_scale
print(a[i])
elif ns % 4 == 1:
a[i] = scale_inv
print(a[i])
ns+=1
np.savez(experiment_name+"cameras_sphere.npz", **a) #np.save save as .npy |
What is the meaning of each element of 'cameras_xxx.npz', i.e., of 'camera_mat_xx', 'camera_mat_inv_xx', 'world_mat_xx', 'world_mat_inv_xx', and 'scale_mat_xx'?
The text was updated successfully, but these errors were encountered: