colmap / colmap

COLMAP - Structure-from-Motion and Multi-View Stereo
https://colmap.github.io/
Other
7.75k stars 1.53k forks source link

Failed when triangulate with known camera poses and intrinsics(FULL_OPENCV cam_model) #1980

Open nickle-fang opened 1 year ago

nickle-fang commented 1 year ago

Describe the bug I have 5 cameras and each has its own intrinsics. I first calibrate these cameras and get the intrinsics. Then I have some images taken by all 5 cameras and I know each image's pose. At the same time I use hloc to extract and matching the feature of images which are saved to txt file. I want to triangulate the model using these images and known cameras' intrinsics and extrinsics. I prepare the model file cameras.txt, images.txt and points3D.txt(empty), which are shown below. cameras.txt:

# Camera list with one line of data per camera:
#   CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
# Number of cameras: 5
1 FULL_OPENCV 1920 1648 7292.912325051474 7289.457533421036 972.9299432741975 809.2597952227599 0.7481064663138995 -298.0947816014325 -0.005971468844207832 -0.0016655182652244636 22787.756175200848 0.0 0.0 0.0
2 FULL_OPENCV 1920 1648 8213.457524067382 8206.344376454648 976.9405646176303 847.0238644547399 0.7635691739869576 -134.18959632155327 0.00021581583630352402 -0.002665278856159319 -12394.218649715454 0.0 0.0 0.0
3 FULL_OPENCV 1920 1648 8266.024249034925 8267.774422225122 959.8245149492589 812.0871990030914 0.6383478891634475 -167.0744321761916 -0.01429774759419683 -0.0031477459162405335 11942.558225831985 0.0 0.0 0.0
4 FULL_OPENCV 1920 1648 7709.086422776101 7722.977499257139 961.3914961262117 825.3373760795041 0.9910063737209929 -243.5587012422901 0.0031580998897623564 0.0031031494000493655 33122.24569332885 0.0 0.0 0.0
5 FULL_OPENCV 1920 1648 7647.067740014194 7651.5391690497845 970.480634443255 833.738623122455 -0.3801237714475541 254.39262587589985 0.005575379931136014 -0.0008896639708795915 -36608.079204175316 0.0 0.0 0.0

images.txt: [part of the file]

# Image list with two lines of data per image:
#   IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME
#   POINTS2D[] as (X, Y, POINT3D_ID)
# Number of images: 180, mean observations per image: 97.4888888888889
1 0.9381001520412074 0.34633989737779586 -0.002380523710100557 -0.0033336663700472557 -0.029484553105536614 -0.05756142123489446 1.051543166936826 1 0/00000000.jpg

2 0.9344361486908207 0.34443062154102433 -0.08438978746896386 -0.032787112341171626 -0.03603503050311285 -0.05420086094969056 1.0476195065890348 1 0/00000001.jpg
......

I run these commands in order:

colmap feature_importer ...
colmap matches_importer ...
colmap point_triangulator ...

The first two commands run successfully, but when I came to point_triangulator, the error occurs:

F0626 05:36:35.936512 51491 sfm.cc:473] Check failed: bundle_adjuster.Solve(&reconstruction) 
*** Check failure stack trace: ***
    @     0x7f774e6a10cd  google::LogMessage::Fail()
    @     0x7f774e6a2f33  google::LogMessage::SendToLog()
    @     0x7f774e6a0c28  google::LogMessage::Flush()
    @     0x7f774e6a3999  google::LogMessageFatal::~LogMessageFatal()
    @     0x5616fefa0785  (unknown)
    @     0x5616fefa0c1f  (unknown)
    @     0x5616fef5de65  (unknown)
    @     0x7f773462ac87  __libc_start_main
    @     0x5616fef61c9a  (unknown)
Aborted (core dumped)

I checked the output and found that all images output like this: (Triangulated 0 points)

Triangulating image #180 (179)
==============================================================================

  => Image sees 0 / 735 points
  => Triangulated 0 points

I then change the camera model to PINHOLE and delete the distortion params, it worked (shown as below). I doubt if the FULL_OPENCV model is not supported in triangulator? Or I have missed some settings? Thanks a lot !

Changed cameras params:

# Camera list with one line of data per camera:
#   CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
# Number of cameras: 5
1 PINHOLE 1920 1648 7292.912325051474 7289.457533421036 972.9299432741975 809.2597952227599
2 PINHOLE 1920 1648 8213.457524067382 8206.344376454648 976.9405646176303 847.0238644547399
3 PINHOLE 1920 1648 8266.024249034925 8267.774422225122 959.8245149492589 812.0871990030914
4 PINHOLE 1920 1648 7709.086422776101 7722.977499257139 961.3914961262117 825.3373760795041
5 PINHOLE 1920 1648 7647.067740014194 7651.5391690497845 970.480634443255 833.738623122455
pwais commented 7 months ago

@nickle-fang Any more luck here? I have run into some similar problems with the FULL_OPENCV model.

point_triangulator requires a reconstruction, but your comments suggest you only have a colmap.db with features and matches. The incremental mapper needs TwoViewGeometries to create an initial construction, so you'd need that stuff before running the triangulator I think. But did you try anything else perhaps?

Also some of the distortion params in your FULL_OPENCV input look way too big maybe?