ubc-vision/image-matching-benchmark

How to load the camera parameters from the sparse folder?

Closed this issue · 7 comments

Excuse me, I tried your COLMAP for SFM on a raw images dataset and got sparse folder containing 3 .bin files.

I wonder how to load the data from the sparse/camera.bin for camera intrinsics and sparse/images.bin for camera extrinsics.
They seem to be binary files but I an not sure about how to load them.

In addition, I wonder how to transform those data into K,R,T matrix for camera parameters as you displayed in the calibration h5 files from the datasets in the repo:
https://github.com/vcg-uvic/learned-correspondence-release

You can load them with the colmap GUI, convert them with colmap model_converter, or use python/matlab bindings to load them. For the latter, you have an example on example/training_data/parse_data.ipynb, which I mentioned yesterday. That should show you all you can do with the data. IIRC we don't do any conversion with the calibration data, so you can use it as is.

Thanks for your immediate reply! I will check it as you described.

Well, @etrulls I am sorry to bother you again.
I found the File->Export model as text in GUI and got the text format camera data files.

Then I tried to use the data to generate the K,R,T matrix in your LFGC repo for dataset calibration data.

But I can not understand the data in cameras.txt.
I have got a cameras.txt as:

\# Camera list with one line of data per camera:
\# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
\# Number of cameras: 2
1 PINHOLE 8176 6132 12842.3 11590.6 4088 3066
2 PINHOLE 8176 6132 12894.3 11584.1 4088 3066

I wonder what is the K matrix for the 2 cameras.
For the 1st camera: the PARAMS[] are: 12842.3 11590.6 4088 3066
How to get the K matrix as you provided from LFGC dataset?

I am sorry for the camera model mistake.
I changed the camera model as: SIMPLE_RADIAL and got txt as:

\# Camera list with one line of data per camera:
\# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
\# Number of cameras: 2
1 SIMPLE_RADIAL 8176 6132 8318.1 4088 3066 -0.00517715
2 SIMPLE_RADIAL 8176 6132 8296.3 4088 3066 -0.0051946

What does the 8318.1 4088 3066 -0.00517715 mean for the 1st camera PARAMS[]?
Then how to generate the K matrix for the camera?

I've answered this twice already... can you please look at the notebook? It contains plenty of examples for everything you're asking.

@etrulls
I am so sorry to bother you without checking the examples carefully.
Thanks for your repeated answers, I solved the problem.
Sorry to bother you with that.

No worries.