Indicate focal point of the camera

Hi all,

I want to change the focal length of the camera when launching projects in webodm, that is to say my camera has a focal length of 2.8 mm and webodm misinterprets it for me, so I would like to know if there is any specific option so that I indicate this parameter to webodm

Greetings and thank you!

Yes, take the cameras.json file from a previous run and change the focal values. Then process a new task specifying the “cameras” task option copying/pasting the contents of the modified cameras.json.

2 Likes

Thanks for the reply,
but I get an error when launching a project.

My modified camera.json file is as follows:

  {
      "unknown unknown 3840 2160 fisheye 0 rgb": {
            "p2": 0.011033534397183613, 
            "p1": 0.004262280833526967, 
            "width": 3840, 
            "projection_type": "fisheye", 
            "height": 2160, 
            "k3": 0.0024024302227827875, 
            "k2": 0.01436395906890277, 
            "k1": 0.059447948629159746, 
            "focal_y": 2.8, 
            "focal_x": 2.8, 
            "c_y": -0.004050441403242289, 
            "c_x": -0.001988139775925176
        }
    }

My additional project options are these:

**Options**: rerun-from: dataset, mve-confidence: 0.2, orthophoto-resolution: 1, dem-resolution: 1, ignore-gsd: true, crop: 0, dsm: true, depthmap-resolution: 1000

And the error I get is the following:

        [INFO]    Initializing ODM - Tue Aug 11 03:41:36  2020
        [INFO]    ==============
        [INFO]    build_overviews: False
        [INFO]    camera_lens: auto
        [INFO]    cameras: {u'unknown unknown 3840 2160 fisheye 0 rgb': {u'p2': 0.011033534397183613, u'p1': 0.004262280833526967, u'k2': 0.01436395906890277, u'projection_type': u'fisheye', u'height': 2160, u'k3': 0.0024024302227827875, u'width': 3840, u'k1': 0.059447948629159746, u'focal_y': 2.8, u'focal_x': 2.8, u'c_y': -0.004050441403242289, u'c_x': -0.001988139775925176}}
        [INFO]    crop: 0.0
        [INFO]    debug: False
        [INFO]    dem_decimation: 1
        [INFO]    dem_euclidean_map: False
        [INFO]    dem_gapfill_steps: 3
        [INFO]    dem_resolution: 1.0
        [INFO]    depthmap_resolution: 1000.0
        [INFO]    dsm: True
        [INFO]    dtm: False
        [INFO]    end_with: odm_report
        [INFO]    fast_orthophoto: False
        [INFO]    feature_type: sift
        [INFO]    force_gps: False
        [INFO]    gcp: None
        [INFO]    gps_accuracy: 15
        [INFO]    ignore_gsd: True
        [INFO]    matcher_distance: 0
        [INFO]    matcher_neighbors: 8
        [INFO]    max_concurrency: 6
        [INFO]    merge: all
        [INFO]    mesh_octree_depth: 10
        [INFO]    mesh_point_weight: 4
        [INFO]    mesh_samples: 1.0
        [INFO]    mesh_size: 200000
        [INFO]    min_num_features: 8000
        [INFO]    mve_confidence: 0.2
        [INFO]    name: b8387e00-51cb-4359-bf06-e162d6015975
        [INFO]    opensfm_depthmap_method: PATCH_MATCH
        [INFO]    opensfm_depthmap_min_consistent_views: 3
        [INFO]    opensfm_depthmap_min_patch_sd: 1
        [INFO]    optimize_disk_space: False
        [INFO]    orthophoto_compression: DEFLATE
        [INFO]    orthophoto_cutline: False
        [INFO]    orthophoto_no_tiled: False
        [INFO]    orthophoto_png: False
        [INFO]    orthophoto_resolution: 1.0
        [INFO]    pc_classify: False
        [INFO]    pc_csv: False
        [INFO]    pc_ept: False
        [INFO]    pc_filter: 2.5
        [INFO]    pc_las: False
        [INFO]    pc_rectify: False
        [INFO]    pc_sample: 0
        [INFO]    project_path: /www/data
        [INFO]    radiometric_calibration: none
        [INFO]    rerun: None
        [INFO]    rerun_all: False
        [INFO]    rerun_from: ['dataset', 'split', 'merge', 'opensfm', 'mve', 'odm_filterpoints', 'odm_meshing', 'mvs_texturing', 'odm_georeferencing', 'odm_dem', 'odm_orthophoto', 'odm_report']
        [INFO]    resize_to: 2048
        [INFO]    skip_3dmodel: False
        [INFO]    sm_cluster: None
        [INFO]    smrf_scalar: 1.25
        [INFO]    smrf_slope: 0.15
        [INFO]    smrf_threshold: 0.5
        [INFO]    smrf_window: 18.0
        [INFO]    split: 999999
        [INFO]    split_multitracks: False
        [INFO]    split_overlap: 150
        [INFO]    texturing_data_term: gmi
        [INFO]    texturing_keep_unseen_faces: False
        [INFO]    texturing_nadir_weight: 16
        [INFO]    texturing_outlier_removal_type: gauss_clamping
        [INFO]    texturing_skip_global_seam_leveling: False
        [INFO]    texturing_skip_hole_filling: False
        [INFO]    texturing_skip_local_seam_leveling: False
        [INFO]    texturing_skip_visibility_test: False
        [INFO]    texturing_tone_mapping: none
        [INFO]    time: False
        [INFO]    use_3dmesh: False
        [INFO]    use_exif: False
        [INFO]    use_fixed_camera_params: False
        [INFO]    use_hybrid_bundle_adjustment: False
        [INFO]    use_opensfm_dense: False
        [INFO]    verbose: False
        [INFO]    ==============
        [INFO]    Running dataset stage
        [INFO]    Loading dataset from: /www/data/b8387e00-51cb-4359-bf06-e162d6015975/images
        [INFO]    Loading 6 images
        [INFO]    Wrote images database: /www/data/b8387e00-51cb-4359-bf06-e162d6015975/images.json
        [INFO]    Found 6 usable images
        [INFO]    Parsing SRS header: WGS84 UTM 30N
        [INFO]    Finished dataset stage
        [INFO]    Running split stage
        [INFO]    Normal dataset, will process all at once.
        [INFO]    Finished split stage
        [INFO]    Running merge stage
        [INFO]    Normal dataset, nothing to merge.
        [INFO]    Finished merge stage
        [INFO]    Running opensfm stage
        [INFO]    Wrote camera_models_overrides.json to OpenSfM directory
        [INFO]    Altitude data detected, enabling it for GPS alignment
        [INFO]    ['use_exif_size: no', 'feature_process_size: 2048', 'feature_min_frames: 8000', 'processes: 6', 'matching_gps_neighbors: 8', 'matching_gps_distance: 0', 'depthmap_method: PATCH_MATCH', 'depthmap_resolution: 1000.0', 'depthmap_min_patch_sd: 1', 'depthmap_min_consistent_views: 3', 'optimize_camera_parameters: no', 'undistorted_image_format: tif', 'bundle_outlier_filtering_type: AUTO', 'align_orientation_prior: vertical', 'triangulation_type: ROBUST', 'bundle_common_position_constraints: no', 'feature_type: SIFT', 'use_altitude_tag: yes', 'align_method: auto', 'local_bundle_radius: 0']
        [INFO]    running /usr/bin/env python2 /code/SuperBuild/src/opensfm/bin/opensfm extract_metadata "/www/data/b8387e00-51cb-4359-bf06-e162d6015975/opensfm"
        2020-08-11 03:41:37,729 INFO: Extracting EXIF for f6.jpg
        2020-08-11 03:41:37,740 INFO: Extracting EXIF for f5.jpg
        2020-08-11 03:41:37,746 INFO: Extracting EXIF for f3.jpg
        2020-08-11 03:41:37,750 INFO: Extracting EXIF for f2.jpg
        2020-08-11 03:41:37,753 INFO: Extracting EXIF for f4.jpg
        2020-08-11 03:41:37,756 INFO: Extracting EXIF for f1.jpg
        Traceback (most recent call last):
        File "/code/SuperBuild/src/opensfm/bin/opensfm", line 34, in <module>

        command.run(args)
        File "/code/SuperBuild/src/opensfm/opensfm/commands/extract_metadata.py", line 48, in run

        overrides = data.load_camera_models_overrides()
        File "/code/SuperBuild/src/opensfm/opensfm/dataset.py", line 479, in load_camera_models_overrides

        return io.cameras_from_json(obj)
        File "/code/SuperBuild/src/opensfm/opensfm/io.py", line 196, in cameras_from_json

        cameras[key] = camera_from_json(key, value)
        File "/code/SuperBuild/src/opensfm/opensfm/io.py", line 68, in camera_from_json

        camera.focal = obj['focal']
        KeyError
        :
        u'focal'

        Traceback (most recent call last):
        File "/code/run.py", line 61, in <module>
        app.execute()
        File "/code/stages/odm_app.py", line 95, in execute
        self.first_stage.run()
        File "/code/opendm/types.py", line 350, in run
        self.next_stage.run(outputs)
        File "/code/opendm/types.py", line 350, in run
        self.next_stage.run(outputs)
        File "/code/opendm/types.py", line 350, in run
        self.next_stage.run(outputs)
        File "/code/opendm/types.py", line 331, in run
        self.process(self.args, outputs)
        File "/code/stages/run_opensfm.py", line 28, in process
        octx.extract_metadata(self.rerun())
        File "/code/opendm/osfm.py", line 221, in extract_metadata
        self.run('extract_metadata')
        File "/code/opendm/osfm.py", line 23, in run
        (context.opensfm_path, command, self.opensfm_project_path))
        File "/code/opendm/system.py", line 76, in run
        raise Exception("Child returned {}".format(retcode))
        Exception: Child returned 1

Any idea what may be going on?

The fisheye model does not have focal_x and focal_y, just focal (which is missing?)

1 Like

okay thank you very much.

Is there any tutorial or guide on how to change the camera settings? something that is more specific, I’m a bit lost on this issue.

Anyway thank you very much!