I'd be interested in knowing camera pose (R|t) estimated by the SfM tools (openMVG_main_GlobalSfM oropenMVG_main_IncrementalSfM). Are those information saved somehow in the output files generated by the tools? Is there an easy way to get them?
You can convert the output sfm_data.bin to json and then parse the data.
To do so you can use the openMVG_main_ConvertSfM_DataFormat binary
Usage: openMVG_main_ConvertSfM_DataFormat
[-i|--input_file] path to the input SfM_Data scene
[-o|--output_file] path to the output SfM_Data scene
.json, .bin, .xml, .ply
[Options to export partial data (by default all data are exported)]
Usable for json/bin/xml format
[-V|--VIEWS] export views
[-I|--INTRINSICS] export intrinsics
[-E|--EXTRINSICS] export extrinsics (view poses)
[-S|--STRUCTURE] export structure
[-C|--CONTROL_POINTS] export control points
By default all the data will be exported and the json file can be huge, but you can export a particular part by using the option.
For example here only the camera and image related info are exported
openMVG_main_ConvertSfM_DataFormat binary -i yoursfm_data.bin -o sfm-data.json -V -I -E
Then for each view you can look to its pose ids and then retrieve the corresponding pose in the extrinsics data.
Feel free to ask more question or close the issue if the answer was sufficient for your needs.
thanks @pmoulon for the quick reply. I managed to convert the binary data to json format. I can see there are rotation and center info. Are those the Rotation matrix and Translation vector?
I have another question . Is there a minimum number of images to be provided to the SfM tools to get the sparse point cloud? Is it possible to use just 2 images?
Thanks in advance for your help and thaks for this great tools!
Data that are exported are the rotation matrix and the world camera position => C
.
See here for the relationship between t
and C
.
Two image will be ok for Incremental/Sequential SfM but not for Global SfM.
Two images allow to compute at least a relative pose and so to provide a point cloud.
Feel free to ask more question or close the issue if all your questions was answered.
thanks
Most helpful comment
You can convert the output sfm_data.bin to json and then parse the data.
To do so you can use the openMVG_main_ConvertSfM_DataFormat binary
By default all the data will be exported and the json file can be huge, but you can export a particular part by using the option.
For example here only the camera and image related info are exported
Then for each view you can look to its pose ids and then retrieve the corresponding pose in the extrinsics data.
Feel free to ask more question or close the issue if the answer was sufficient for your needs.