{"id":23188269,"url":"https://github.com/afichet/camera-calibration","last_synced_at":"2025-10-25T10:31:45.609Z","repository":{"id":40367531,"uuid":"301857201","full_name":"afichet/camera-calibration","owner":"afichet","description":"Applications for camera colorimetric calibration using a Macbeth colorchecker.","archived":false,"fork":false,"pushed_at":"2022-05-12T13:41:57.000Z","size":18927,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-18T11:13:29.319Z","etag":null,"topics":["calibration","color","colorimetric","colorimetry","image-processing","photography"],"latest_commit_sha":null,"homepage":"","language":"C++","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/afichet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-06T21:19:14.000Z","updated_at":"2024-11-01T22:07:56.000Z","dependencies_parsed_at":"2022-08-09T18:23:50.200Z","dependency_job_id":null,"html_url":"https://github.com/afichet/camera-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/afichet%2Fcamera-calibration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afichet%2Fcamera-calibration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afichet%2Fcamera-calibration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afichet%2Fcamera-calibration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afichet","download_url":"https://codeload.github.com/afichet/camera-calibration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238121376,"owners_count":19419862,"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":["calibration","color","colorimetric","colorimetry","image-processing","photography"],"created_at":"2024-12-18T11:13:34.478Z","updated_at":"2025-10-25T10:31:42.121Z","avatar_url":"https://github.com/afichet.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Building the toolkit\n====================\n\nFirst, checkout the repository:\n\n```bash\ngit clone https://github.com/afichet/camera-calibration.git\ncd camera-calibration\ngit submodule init\ngit submodule update\n```\n\n## Dependencies\n\nOn all platforms, you need CMake, a C and a C++ compiler.\n\n### Windows and macOS\n\nWe compile levmar without BLAS / LAPACK to have simple compilation\npipeline on those platforms. You can re-enable it in the\n`external/levmar-2.6/CMakeLists.txt` for better performances.\n\n### Linux\n\nYou need f2c (`libf2c2-dev` on Ubuntu 20.04LTS), BLAS / LAPACK. See\nhttp://users.ics.forth.gr/~lourakis/levmar/\n\n## Compilation\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n\nImages\n======\n\nWe currently support TIFF and EXR images for reading and\nwritting. TIFF are supported only if `libtiff` is available on the\nsystem.\n\n\nApplications\n============\n\n## Colourotron\n\n`Colourotron` is a GUI application to fit a correction matrix from a shot of a \nMacbeth colourchecker. The source code is in the `app/gui` folder.\n\n## Extract patches\n\n`extract-patches` is used for creating a CSV file from an image and a\nCSV containing the areas to average. The CSV file contains the top\nleft pixel and bottom right pixel for the box to extract.\n\n```csv\n\u003ctop left x\u003e, \u003ctop left y\u003e, \u003cbottom left x\u003e, \u003cbottom right y\u003e\n...\n```\n\nYou can control which area are averaged using the `overlay-areas`\nutility.\n\n## Overlay areas\n\n`overlay-areas` is used to display an overlay of the area that are\ngoing to be averaged by `extract-patches` utility.\n\n## Generate reference colorchart\n\n`gen-ref-colorchart` is used to create a CSV file containing the XYZ\nvalues of each color patch from reference measured data (available\nhere: https://www.babelcolor.com/colorchecker-2.htm) given an\nilluminant and color matching functions (CMFs).\n\n## Generate colorchart image\n\n`gen-colorchart-image` creates a PNG preview of a given CSV file\ncontaining color values of each patch of a Macbeth colorchecker.\n\n## Fitting\n\n`extract-matrix` fits a transformation matrix from a measured set of\ncolors to a reference set of colors.\n\n## Correct patches\n\n`correct-patches` corrects color values of each patches contained in a\nCSV file using the provided transformation matrix.\n\n## Correct image\n\n`correct-image` corrects color values of each pixel from a TIFF or EXR\nfile using the provided transformation matrix.\n\n## Conversion to DNG\n\n`raw-to-dng` handles the propriatery RAW format this application targets and\noutputs a standard DNG file. It requires a calibration matrix that can be\nextracted using `Colourotron` fitting feature.\n\n\nPipeline example\n================\n\nWe provide a pipeline example in `run.sh` script.\n\n## GUI\n\n### Colour calibration\n\nThis is the recommended solution.\n\nOpen your image with `Colourotron`. \n1- Move the Macbeth outline to match the captured Macbeth.\n2- Click on `Fit...`. \n3- Click on `Apply`.\n4- Save the matrix with `File -\u003e Save correction matrix...`\n\nThis matrix can then be used with the command line tools.\n\n### Demosaicing\n\nTo perform colour correction, you either can convert the propriatery RAW to DNG\nor first debayer the image and apply the correction matrix. To debayer the \nimage, use `derawzinator`:\n\n```bash\n./build/bin/derawzinator \\\n    raw_image_INFO.txt \\\n    raw_image.exr\n```\n\n### Colour correction\n\nWe can correct any given RGB image using the matrix:\n\n```bash\n./build/bin/correct-image \\\n    data/measurements/Colors_0000000320_dem.tiff \\\n    output/matrix.csv \\\n    output/corrected_image.tiff\n```\n\nYou can also convert the propriatery RAW format to DNG:\n\n```bash\n./build/bin/raw-to-dng \\\n    raw_image_INFO.txt \\\n    output/matrix.csv \\\n    output/output.dng\n```\n\n## Command line\n\nFirst, you need to extract from a TIFF file the values of the Macbeth\ncolor checker. You need as well a CSV file (comma separated)\ndescribing each area to average.\n\n```bash\nmkdir output\n\n./build/bin/extract-patches\n    data/measurements/Colors_0000000320_dem.tiff \\\n    data/measurements/boxes.csv \\\n    output/patches.csv\n```\n\nThen, you need to generate a reference set of Macbeth patches given an\nilluminant and color matching functions:\n\n```bash\n./build/bin/gen-ref-colorchart \\\n    data/D65.csv \\\n    data/XYZ.csv \\\n    output/reference.csv\n```\n\nNow, let's see how this reference colour chart looks like:\n\n```bash\n./build/bin/gen-colorchart-image \\\n    output/reference.csv \\\n    output/reference.exr\n```\n\nAnd how the averaged measured one looks like:\n\n```bash\n./build/bin/gen-colorchart-image \\\n    output/patches.csv \\\n    output/orig_measured.exr \\\n\ttrue\n```\n\nNow, we want to find the matrix which transform the measured color to\nthe reference colors:\n\n```bash\n./build/bin/extract-matrix \\\n    output/reference.csv \\\n    output/patches.csv \\\n    output/matrix.csv\n```\n\nFinally, we correct the measured patches:\n\n```bash\n./build/bin/correct-patches \\\n    output/patches.csv \\\n    output/matrix.csv \\\n    output/corrected_patches.csv\n```\n\nAnd, create an image of the corrected patches:\n\n```bash\n./build/bin/gen-colorchart-image \\\n    output/corrected_patches.csv \\\n    output/corrected_measured.exr\n```\n\nWe also can correct any given image using the matrix, here the input\nimage:\n\n```bash\n./build/bin/correct-image \\\n    data/measurements/Colors_0000000320_dem.tiff \\\n    output/matrix.csv \\\n    output/corrected_image.tiff\n```\n\nYou can also convert the propriatery RAW format to DNG:\n\n```bash\n./build/bin/raw-to-dng \\\n    raw_image_INFO.txt \\\n    output/matrix.csv \\\n    output/output.dng\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafichet%2Fcamera-calibration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafichet%2Fcamera-calibration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafichet%2Fcamera-calibration/lists"}