Error when trying to use Brown-Conrady camera model

Hello OpenDroneMap community,

I’ve been very happily using ODM from the terminal since a couple of weeks, slowly trying to hone in on the best possible parameters for a particular reconstruction of some desert land.

I recently tried gathering calibration data for the camera lens of my done. While the two-parameter (perspective) distortion model works fine, I am getting the following error in the OpenSfM stage when I run with my five-parameter (brown) model:

  File "/home/fester/dev/sfm/OpenSfM/opensfm/mesh.py", line 66, in triangle_mesh_perspective
    vertices[i] = back_project_no_distortion(shot, pixels[i], d).tolist()
  File "/home/fester/dev/sfm/OpenSfM/opensfm/mesh.py", line 76, in back_project_no_distortion
    p = np.array([pixel[0], pixel[1], shot.camera.focal])
AttributeError: 'BrownPerspectiveCamera' object has no attribute 'focal'

Any ideas what I am doing wrong? My cameras.json file looks like so:

{
    "dji fc2204 4000 3000 perspective 0.6666": {
        "projection_type": "brown", 
        "width": 4000, 
        "height": 3000, 
        "c_x": 0.492639, 
        "c_x_prior": 0.492639, 
        "c_y": 0.503773, 
        "c_y_prior": 0.503773, 
        "k1": -0.040661, 
        "k1_prior": -0.040661, 
        "k2": 0.104878, 
        "k2_prior": 0.104878, 
        "k3": -0.095506, 
        "k3_prior": -0.095506, 
        "p1": 0.000122, 
        "p1_prior": 0.000122, 
        "p2": 0.000276, 
        "p2_prior": 0.000276, 
        "focal": 0.721327, 
        "focal_prior": 0.721327, 
        "focal_x": 0.721327, 
        "focal_x_prior": 0.721327, 
        "focal_y": 0.721327, 
        "focal_y_prior": 0.721327
    }
}

Thank you in advance,
Gottfried

It looks as the OpenSfM brown camera definition does not have a “focal” attribute (https://github.com/mapillary/OpenSfM/blob/master/opensfm/types.py#L296) (has focal_x and focal_y instead). I’ve updated the bug you opened on https://github.com/OpenDroneMap/ODM/issues/1009 :+1:

1 Like