Comments (9)
@JiayingGaoo you dont need to convert your poses to quaternions. You can directly use your transform.json. Make sure, that your poses are in opencv(=colmap) format.
from instant-dexnerf.
Hi @melhashash
Quaternions in groundtruth_handeye.txt
follow the format (x, y, z, w)
, make sure that you use this convention. Let me know, if it solves the problem
If you have poses in colmap format, you can directly use them! You don't need to transform them in quaternions
from instant-dexnerf.
Hi,
I have a question about the convention used in
groundtruth_handeye.txt
. How to generate it given the pose in COLMAP format?I tried the following code to generate
groundtruth_handeye.txt
and then use it withinstrinsics.txt
to generated the json file usingours2nerf.py
but the generated camera poses are incorrect, as shown below (they should be 360)This code reads
images.txt
file in COLMAP formatfor line in f: line = line.strip() if line[0] == "#": continue i = i + 1 if i < SKIP_EARLY*2: continue if i % 2 == 1: elems=line.split(" ") # 1-4 is quat, 5-7 is trans, 9ff is filename (9, if filename contains no spaces) image_rel = os.path.relpath(IMAGE_FOLDER) name = str(f"./{image_rel}/{'_'.join(elems[9:])}") image_id = int(elems[0]) qvec = np.array(tuple(map(float, elems[1:5]))) tvec = np.array(tuple(map(float, elems[5:8]))) R = qvec2rotmat(qvec) t = tvec.reshape([3,1]) m = np.concatenate([np.concatenate([R, t], 1), bottom], 0) c2w = np.linalg.inv(m) R = c2w[:3,:3] t = c2w[:3,3] q = rotm2quat(R) f_c2w_pose_file.write(f"{counter} {q[0]} {q[1]} {q[2]} {q[3]} {t[0]} {t[1]} {t[2]}\n") counter = counter + 1
BTW, where is the definition of the function rotm2quat? I cannot find it
from instant-dexnerf.
@JiayingGaoo There is no rotm2quat function. It is @melhashash's code 😅
from instant-dexnerf.
Oh sorry. I just want to know how to generate groundtruth_handeye.txt by my own data, for now I have colmap_text and transform.json, then what to do? Thanks a lot
from instant-dexnerf.
BTW, where is the definition of the function rotm2quat? I cannot find it
I did not share the whole codes, only the loop to do conversion. Here it is:
def rotm2quat(m):
#q0 = qw
t = np.matrix.trace(m)
q = np.asarray([0.0, 0.0, 0.0, 0.0], dtype=np.float64)
if(t > 0):
t = np.sqrt(t + 1)
q[3] = 0.5 * t
t = 0.5/t
q[0] = (m[2,1] - m[1,2]) * t
q[1] = (m[0,2] - m[2,0]) * t
q[2] = (m[1,0] - m[0,1]) * t
else:
i = 0
if (m[1,1] > m[0,0]):
i = 1
if (m[2,2] > m[i,i]):
i = 2
j = (i+1)%3
k = (j+1)%3
t = np.sqrt(m[i,i] - m[j,j] - m[k,k] + 1)
q[i] = 0.5 * t
t = 0.5 / t
q[3] = (m[k,j] - m[j,k]) * t
q[j] = (m[j,i] + m[i,j]) * t
q[k] = (m[k,i] + m[i,k]) * t
return q
from instant-dexnerf.
@salykovaa thanks!
As you mentioned, transform.json has the same format of colmap/opencv defined in the word coordinate system.
from instant-dexnerf.
transform.json
When I run scripts/main.py to generate depth images, it seems that I need to prepare three files: base.msgpack, intrinsics.txt and groundtruth_handeye.txt. Do you mean that groundtruth_handeye.txt is not necessary for my case (transform.json from colmap is enough)? Thanks a lot!
from instant-dexnerf.
transform.json
When I run scripts/main.py to generate depth images, it seems that I need to prepare three files: base.msgpack, intrinsics.txt and groundtruth_handeye.txt. Do you mean that groundtruth_handeye.txt is not necessary for my case (transform.json from colmap is enough)? Thanks a lot!
Yes, I think you only need to provide transform.json + images.
from instant-dexnerf.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instant-dexnerf.