Author Topic: Point cloud generation with and without GCPs  (Read 1035 times)


  • Newbie
  • *
  • Posts: 8
    • View Profile
Point cloud generation with and without GCPs
« on: May 07, 2021, 03:16:14 PM »

I have a set of four images with which I use 15 GCPs to construct a dense cloud and then a DEM of my survey domain. I use these 15 GCPs to optimize my camera positions, view angles and lenses parameters.

I then wrote a python script to generate point cloud & DEM of the same domain using the exact same images, but instead of using GCPs, I use as inputs the optimized camera positions, view angles and lenses parameters. In doing so, I was thinking I would get the exact same results with and without GCPs, but this is not the case and whatever I've tried there's always a small shift remaining - I don't understand where this would come from, does anyone have an idea?

Here's the script I am using to process the images without GCPs:

Code: [Select]

import Metashape
import csv

global doc
doc =
path = 'path'

# Add chunk
chunk = doc.chunk

# load images to chunk

# Load camera position & view angles

#define coordinate system = Metashape.CoordinateSystem("EPSG::32646")

# Import calibration parameters of cameras (one group per camera since each has different parameters)

for camera in chunk.cameras:
    Group = chunk.addCameraGroup()
    filename = 'path2calibration'
    calib = Metashape.Calibration()
    calib.load(filename, format = Metashape.CalibrationFormatAustralis)
    sensor = chunk.addSensor()
    sensor.width = calib.width
    sensor.height = calib.height
    sensor.type = calib.type
    sensor.user_calib = calib
    sensor.fixed = True = Group
    camera.sensor = sensor

# Match photos
accuracy = 0  # equivalent to highest accuracy
keypoints = 200000 #align photos key point limit
tiepoints = 20000 #align photos tie point limit
chunk.matchPhotos(downscale=accuracy, generic_preselection = True,reference_preselection=False,\
                  filter_mask = False, keypoint_limit = keypoints, tiepoint_limit = tiepoints)

# Enable rotation angles for alignement
for camera in chunk.cameras:
    camera.reference.rotation_enabled = True

# Align cameras
chunk.alignCameras(adaptive_fitting=False) #align cameras without adaptive fitting of distortion coefficients

## Optimize cameras - first optimization without GCPs
chunk.optimizeCameras(fit_f=False, fit_cx=False, fit_cy=False, fit_b1=False,\
                      fit_b2=False, fit_k1=True,fit_k2=False, fit_k3=False,\
                      fit_k4=False, fit_p1=False, fit_p2=False, fit_corrections=False,\
                      adaptive_fitting=False, tiepoint_covariance=False)



  • Hero Member
  • *****
  • Posts: 1037
    • View Profile
Re: Point cloud generation with and without GCPs
« Reply #1 on: May 07, 2021, 04:20:48 PM »
Hi MarinK,

I think that your final adjusted or estimated camera locations and rotations will not be exactly equal to your reference input and thus generated cloud and DEM will be a little different...

To force the estimated to be equal to reference input, I see 2 possibilities:

- set your chunk.camera_location_accuracy and chunk.camera_rotation_accuracy to very low values (i.e. 0.001 mm fo loc and 0.001 deg for rot) so that the camera alignment will vary very little from reference to estimated values;

- use script quick_layout from Agisoft GitHib to set camera estimated values equal to reference values and then do chunk.matchPhotos(...)  followed by chunk.triangulatePoints() (without alignCameras)...

This way you shoud get very close results from original cloud and DEM...
Best Regards,

Paul Pelletier,


  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Point cloud generation with and without GCPs
« Reply #2 on: May 07, 2021, 04:47:05 PM »
Hi Paulo,

Thanks for the advice! Increasing the accuracy does improve the outputs a bit - I guess this will have to be good enough :)