Geo-referencing Model

1,447 views
Skip to first unread message

alex.m...@gmail.com

unread,
Nov 6, 2018, 9:30:47 AM11/6/18
to COLMAP
Hello,

Could someone tell me if colmap geo-references models with GPS data if running the automatic_reconstructor command? My assumption is not.

Related: could someone confirm the correct way to geo-reference is to run model_aligner on the sparse reconstruction and then continue with the steps to generate a dense model?

Thanks for the help in advance,

Alex


Johannes Schönberger

unread,
Nov 8, 2018, 3:49:45 PM11/8/18
to col...@googlegroups.com

Hi Alex,

 

  1. The geo-registration must be run separately and is not part of the automatic reconstruction at the moment.
  2. Yes, you would run the model_aligner on the sparse reconstruction and then run the dense reconstruction. The final dense model should be geo-registered as well then.

 

Cheers,

Johannes

--
You received this message because you are subscribed to the Google Groups "COLMAP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to colmap+un...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/colmap/37736212-0089-48c5-ad8d-031a59396325%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

alex.m...@gmail.com

unread,
Nov 8, 2018, 6:06:54 PM11/8/18
to COLMAP
Hi Johannes,

Thanks for the response. I've done two tests - one without geo-referencing the sparse and one with geo-referencing the sparse. The non-georeferenced model runs find and produces a nice dense model. The geo-referenced sparse however produces a PLY file that is ~ 30kb instead of ~100mb. I wonder if I am producing the ECEF file incorrectly.. Here is an example of two lines.

0a4b757499c57c198666893c5023a79e10368d1d.jpg 4362308.012851885 502164.8166622905 4611347.004930548
10458f69fe1fc6d1f5181a1e20aeabdeb124b982.jpg 4362195.871777323 502265.8027010275 4611446.209255173

And here is the model_aligner call (overriding the sparse):

colmap model_aligner --input_path $SPARSE_PATH/0 --output_path $SPARSE_PATH/0 --ref_images_path $ECEF_PATH --robust_alignment_max_error 1

I noticed the number of decimal places I was using was very high so I have reduced that to 2 and am running this now. Do you have any idea what else could be causing this problem?

Thank you for all the help,

Alex

alex.m...@gmail.com

unread,
Nov 8, 2018, 6:28:18 PM11/8/18
to COLMAP
I just noticed - I think my ECEF coordinates are junk. I will test them now.

alex.m...@gmail.com

unread,
Nov 8, 2018, 8:21:46 PM11/8/18
to COLMAP
Hi Johannes,

I wonder if you would be kind enough to verify my workflow - i'm still struggling to get a dense model from a model_aligned sparse model.


colmap feature_extractor
\
   
--database_path $DATABASE_PATH \
   
--image_path $IMAGES_PATH


colmap exhaustive_matcher
\
   
--database_path $DATABASE_PATH


colmap mapper
\
   
--database_path $DATABASE_PATH \
   
--image_path $IMAGES_PATH \
   
--output_path $SPARSE_PATH


# check if ecef file & align model
if [ -e $ECEF_PATH ]; then

    colmap model_aligner
--input_path $SPARSE_PATH/0 --output_path $SPARSE_PATH/0 --ref_images_path $ECEF_PATH --robust_alignment_max_error 1
else
    rm $ECEF_PATH
    echo
"unable to get exif data from images"
fi  


colmap image_undistorter
\
   
--image_path $IMAGES_PATH \
   
--input_path $SPARSE_PATH/0 \
   
--output_path $DENSE_PATH \
   
--output_type COLMAP \
   
--max_image_size 2000


colmap patch_match_stereo
\
   
--workspace_path $DENSE_PATH \
   
--workspace_format COLMAP \
   
--PatchMatchStereo.geom_consistency true


colmap stereo_fusion
\
   
--workspace_path $DENSE_PATH \
   
--workspace_format COLMAP \
   
--input_type geometric \
   
--output_path $MODEL_PATH


And some sample ECEF lines:

08e1a0ffd0cba4cd801593d23b0682d38a6586e9.jpg 4362.30852819728 502.20651148970245 4611.34309057199
17964ca01e51c05efdd772d18b4dea52c47893f3.jpg 4362.325291317298 502.2087730555094 4611.320377811822

I've converted the image GPS to ECEF coordinates and have verified they are correct.

Thank you for writing some great software and taking the time so support it,

Cheers,

Alex

On Thursday, November 8, 2018 at 8:49:45 PM UTC, Johannes Schönberger wrote:

Johannes Schönberger

unread,
Nov 13, 2018, 1:32:55 AM11/13/18
to col...@googlegroups.com
Hi,

Workflow looks good to me. Not sure what kind of images you are dealing with but did you try with a larger robust alignment threshold?

Cheers,
Johannes

lemas...@gmail.com

unread,
Nov 13, 2018, 1:22:02 PM11/13/18
to COLMAP
Hi Johannes and Alex,

I have also some issues with the model aligner onLinux with latest dev-branch. I'm running sparse reconstruction and just want to align the model, but somehow the TVEC in the image.txt looks strange. For example, I convert the lat, lon, alt coordinates to ECEF the same way as you have provided in the gps.cc (but in Python). For example I have: lat lon alt: 48.81945009091302 11.446398727279231 411.21223145443946 and convert it to ECEF becoming x y z: 4124147.831095706, 835050.202873333, 4777671.646063186. The output in images.txt for TVEC after aligning becomes tx ty tz: -2957.19660746  5152.25857577  2289.37665296 and transforming back to LLA (like in gps.cc) results in lat lon alt: -3.571991902248841 119.85415253461662 -6372267.702050926. I also tried to change robust alignment threshold to different values, used different methods to transform LLA to GPS but nothing worked. My peer is using COLMAP (little older version) on Windows with Matlab and there the aligner works fine with the SAME gps reference coordinates (my transformed ECEF coords are the same as his coords with Matlab).

The TVEC are the ECEF coords right? Do you have any idea clue why this happens?

Cheers,
Selcuk

Johannes Schönberger

unread,
Nov 14, 2018, 2:35:36 AM11/14/18
to col...@googlegroups.com
TVEC is not the camera center. Please refer to the documentation how to obtain the camera center from the QVEC and TVEC parameters: https://colmap.github.io/format.html#images-txt

Alex Mulford

unread,
Nov 14, 2018, 3:42:43 AM11/14/18
to col...@googlegroups.com
I believe this is my problem also. My linear algebra is a little rusty but if I follow correctly we need to use:


-R^t * T


To find the position of the cameras in local model space. 

You received this message because you are subscribed to a topic in the Google Groups "COLMAP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/colmap/6qYieMyK4XI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to colmap+un...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.

lemas...@gmail.com

unread,
Nov 14, 2018, 3:57:00 AM11/14/18
to COLMAP
Hi Johannes,

thanks, we didn't see that we constructed the camera centers from qvec and tvec in Matlab. Now it works fine in pyhton, too. For the case that someone is also using your python scripts to read the model data, you have to do the following:
# based on read_model.py
# load data as usually
cameras
, images, points3D = read_model(path=sys.argv[1], ext=sys.argv[2])

# for every image get the ecef coords by multiplying rotation matrix with translation vector as stated in documentation
for image in images:
  T
= image.tvec.reshape((3,1))
  R
= np.transpose(image.qvec2rotmat())
  ecef_
= np.dot(-1*R, T)

ecef_ now holds aligned x y z coords of camera centers which you can transform back to LLA if needed.

Cheers,
Selcuk

alex.m...@gmail.com

unread,
Nov 16, 2018, 5:03:37 AM11/16/18
to COLMAP
Hi Selcuk,

Would you be able to tell me your workflow for a getting a dense reconstructed model? It would help me greatly.

Currently I'm extracting the GPS from the EXIF data associated to the images and converting this to ECEF and then using this data with model_aligner to generate a sparse model. After that I attempt to run the dense model steps. Are you doing something similar?

Thanks,

Alex

lemas...@gmail.com

unread,
Nov 16, 2018, 5:55:30 AM11/16/18
to COLMAP
Hi Alex,

I only run sparse reconstruction with mainly standard parameters and opencv_fisheye camera model. I cannot help you with dense reconstruction.
When running the aligner, I receive "good" results where the deviation to ground truth gps is <100 meters, but sometimes I get results where the deviation is several thousand kilometers -  nevertheless COLMAP says, that alignment succeeded!?

What does cause this? Did you have such problems, too?

Cheers,
Selcuk

alex.m...@gmail.com

unread,
Nov 16, 2018, 11:06:55 AM11/16/18
to COLMAP
I have am having problems getting a decent dense model. I have set the robust alignment to 100 and still only a small % of the total points are used. I am new to photogrammetry though so I feel I need to improve my understanding of the area...

What parameters do you set for the aligner? 
Message has been deleted

zjchr...@gmail.com

unread,
Sep 4, 2019, 10:33:53 AM9/4/19
to COLMAP
Hi, I encounter the same problem as you , I do the dense reconstruction after model_aligner, and get a bad result
do you find a solution for this problem? Can you share me how you fix it?

在 2018年11月6日星期二 UTC+8下午10:30:47,alex....@gmail.com写道:
Reply all
Reply to author
Forward
0 new messages