{"id":18439457,"url":"https://github.com/idiap/multicamera-calibration","last_synced_at":"2025-08-22T00:30:53.040Z","repository":{"id":46526040,"uuid":"113325498","full_name":"idiap/multicamera-calibration","owner":"idiap","description":"Multi-Camera Calibration Suite","archived":false,"fork":false,"pushed_at":"2018-09-19T08:33:32.000Z","size":92,"stargazers_count":185,"open_issues_count":4,"forks_count":50,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-06T15:36:58.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idiap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-06T14:17:38.000Z","updated_at":"2024-12-03T13:10:29.000Z","dependencies_parsed_at":"2022-09-10T23:55:29.978Z","dependency_job_id":null,"html_url":"https://github.com/idiap/multicamera-calibration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiap%2Fmulticamera-calibration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiap%2Fmulticamera-calibration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiap%2Fmulticamera-calibration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiap%2Fmulticamera-calibration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idiap","download_url":"https://codeload.github.com/idiap/multicamera-calibration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230542288,"owners_count":18242332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T06:24:50.934Z","updated_at":"2024-12-20T06:06:17.987Z","avatar_url":"https://github.com/idiap.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Multi Camera Calibration Suite\n==============================\n\nThis toolset provides the basics for calibrating a multi-camera scene. it contains six utilities for\ndifferent purposes. In this README I will walk the user through the calibration of a multi camera\nscene using this toolset.\n\nDependencies\n------------\n\nthe use of this suite requires\n\n- [ceres-solver](http://ceres-solver.org/)\n- [google logging suite](https://code.google.com/archive/p/google-glog/)\n- [google flags](https://gflags.github.io/gflags/)\n- [OpenCV](http://opencv.org/)\n- [numpy](http://www.numpy.org/)\n\nGetting the source\n------------------\n\nclone the repository using :\n\n```git clone git@github.com:idiap/multicamera-calibration.git```\n\nBuilding the source\n-------------------\n\nGo to the source directory\n\nDo\n\n```\nmkdir build\ncd build\ncmake .. -DCMAKE_BUILD_TYPE=Release\nmake\n```\n\nCompute intrinsic camera parameters\n-----------------------------------\n\nThe intrinsic camera parameters are usually computed finding a known grid with multiple poses on\ndifferent images. To do so we propose the following method.\n\nCapture a video by waving the camera over a grid such as \n[this one](http://docs.opencv.org/2.4/_downloads/acircles_pattern.png) or \n[that one](http://docs.opencv.org/2.4/_downloads/pattern.png). Extract then the frames as images in\na folder then run the software ```bin\\intrinsic```\n\n```bash\nintrinsic [-h] [-n NUM] [-W WIDTH] [-H HEIGHT]\n          [-p {chessboard,circles,asymmetric_circles}] [-o FULL_OUTPUT]\n          [-s SELECT_OUTPUT]\n          input output\n\n          -h:     show help\n          -n:     number of frames to use\n          -w:     width of grid\n          -h:     height of grid\n          -p:     type of grid\n          -o:     output for all frames with a visible grid (optionnal)\n          -s:     output for all n frames (option -n) selected for the calibration computation (optionnal)\n          input:  pattern for the images\n          output: calibration file (json format)\n```\n\nFor example: let's imagine we have the frames in the folder /home/user1/camera1/frames with the asymmetric\ncircles grid provided earlier.\n\nyou would use the script this way\n```bash\nbin/intrinsic -o /home/user1/frames_with_grid -s /home/user1/camera1/selected_frames_with_grid /home/user1/camera1/frames/\\*.bmp /home/user1/camera1/intrinsic.json\n```\n\nonce the computation is done, the undistorted frames are shown.\n  - 'n' goes to next frame\n  - 'p' goes to previous frame\n  - 'q' quits\n\nthis produces the folders with the usable frames and the selected frames so that reproducing the\ncalibration takes less time.\n\nCompute extrinsic camera parameters\n-----------------------------------\n\nThe extrinsic parameters are computed by clicking on points with known coordinates (in cm) in an\nimage. The syntax is the following.\n```bash\nextrinsic [-h] [-p POINTS] [-o OUTPUT_POINTS] intrinsic input output\n\n          -h:        show help\n          -p:        saved points file, used to resume or correct the calibration (optionnal)\n          -o:        output point file. this file will be used with the -p option (optionnal)\n          intrinsic: intrinsic camera parameters\n          input:     image to annotate\n          output:    calibration output\n```\n\nNow using the intrinsic.json file we computed on the previous step, do.\n```bash\nbin/extrinsic /home/user1/camera1/intrinsic.json /home/user1/camera1/video_frames/000000.bmp /home/user1/camera1/extrinsic.json\n```\n\nit shows an the frame 000000.bmp you can left click on a point to add it. it will ask for x and y in\ncm. right click removes last point.\n\n  - 'q' quits without saving\n  - 's' computes the extrinsics and saves\n\nVerify the 3d projections in the scene\n--------------------------------------\n\nNow both the intrinsic and extrinsic calibrations have been computed for cameras 1 to 4\nto check the correspondance between the cameras, you can use the following utility\n\n```bash\ncheck3d [-h] intrinsic extrinsic images cameras\n        -h: help\n        intrinsic: pattern to intrinsic calibrations files\n        extrinsic: pattern to extrinsic calibrations files\n        images:    pattern to camera images (same frame for each camera)\n        cameras:   camera list comma separated\n```\n\nusing all our cameras calibrated, we would go to something like that\n\n```bash\nbin/check3d /home/user1/{}/intrinsic.json /home/user1/{}/extrinsic.json /home/user1/{}/video_frames/000000.bmp camera1,camera2,camera3,camera4\n```\n\nonce the soft launched you get an image from the frame list.\nyou can click on a point in some views, it will appear as a blue dot.\nonce you clicked at least two views you get a red dot representing the\nprojection on the other views.\nleft click removes the blue dot.\nif you clicked wrong, a right click moves the blue dot to the new location.\n\n  - pressing 'n' goes to the next image\n  - pressing 'p' goes to the previous image\n  - pressing 'r' resets the points\n  - pressing 'q' quits the soft\n\nPerform the bundle adjustment\n-----------------------------\n\nto perform the bundle adjustment you need to provide annotations in the .pos format\nthe pos format has one file per frame such as /home/user1/camera1/annotations/000000.pos is the\nannotation for the /home/user1/camera1/video_frames/000000.bmp image.\n\nthe pos format is done as such:\n```\nidentity_name_1\n0 x_val y_val\n1 x_val y_val\n\nidentity_name_2\n0 x_val y_val\n1 x_val y_val\n```\n\npoint number 0 corresponds to feet, 1 to head.\npoint numbers can be sparse and identities don't have to exist on each frame\n\nonce some frames are annotated, run\n\n```bash\nbuild_ba [-h] [-f FIXED_POINTS]\n         intrinsic extrinsic observations cameras output\n\n         -h:           help\n         -f:           pattern to known points that must remain at the same place \n                       i.e. points outputed by the -o option in extrinsic calibration (optionnal)\n         intrinsic:    pattern to intrinsic calibrations files\n         extrinsic:    pattern to extrinsic calibrations files\n         observations: pattern to pos files\n         cameras:      camera list comma separated\n         output:       bundle adjustment problem file\n```\n\n```bash\nbin/build_ba -f /home/user1/{}/points.json /home/user1/{}/intrinsic.json /home/user1/{}/extrinsic.json /home/user1/{}/annotations/\\*.pos /home/user1/ba_problem.txt\n```\n\nthen run the bundle adjustment\n```bash\nbundle_adjuster --input=input --output=output --intrinsic_adjustment=[fixed, unconstrained, two_pass]\n                --input:                bundle adjustment problem file\n                --output:               bundle adjustment problem file, post processing\n                --intrinsic_adjustment: type of adjustment to perform\n```\n\nthere are three types of adjustment\n  - fixed: the intrinsics are fixed, only perform on the extrinsics\n  - unconstrained: adjust all parameters\n  - two_pass: run once fixed and then unconstrained\n\nusing our example, run\n```bash\nbin/bundle_adjuster --input=/home/user1/ba_problem.txt --output=/home/user1/processed_ba.txt\n```\n\nthen we need to convert back the bundle adjustment problem file to camera calibrations\n\n```bash\nextract_ba [-h] input intrinsic extrinsic cameras\n           -h:        help\n           input:     bundle adjustment problem file\n           intrinsic: output to intrinsic calibration file\n           extrinsic: output to extrinsic calibration file\n           cameras:   camera list comma separated\n```\n\nIn our example it translates to\n```bash\nbin/extract_ba /home/user1/processed_ba.txt /home/user1/{}/intrinsic_ba.json /home/user1/{}/extrinsic_ba.json camera1,camera2,camera3,camera4\n```\n\nthen you may check again the projections in 3d like seen previously\n```bash\nbin/check3d /home/user1/{}/intrinsic_ba.json /home/user1/{}/extrinsic_ba.json /home/user1/{}/video_frames/000000.bmp camera1,camera2,camera3,camera4\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiap%2Fmulticamera-calibration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidiap%2Fmulticamera-calibration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiap%2Fmulticamera-calibration/lists"}