Generate *.dcp Camera Profile for Camera Calibration on macOS

This post is a tutorial for digital camera calibration on macOS Sonoma 14 with open source tools. I followed this article on RawTherapee website, but made some modification based on changes in new operating system.

Why not just using the software from the vendor to do this? So far some of the software like the ColorChecker Camera Calibration only generate a 173B *.dcp file from the DNG raw file, which looks very fishy.

  1. Purchase calibration target: many types of calibration targets are supported, like SpyderCHECKER24, ColorCheckerPassport, etc.
  2. Shoot the calibration target: follow “Shooting the Color Target” in this document.
  3. Building dcamprof from source:
    • Download the source code from https://github.com/Beep6581/dcamprof
    • Install homebrew on macOS Sonoma 13.4: follow https://brew.sh, run the following command in terminal:
      /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    • Install gcc and other dependencies with homebrew: dcamprof requires GCC to compile but modern macOS only uses llvm, so we have to install our own copy of GCC.
      brew install gcc little-cms2 libtiff
    • Modifying the Makefile. First run brew list gcc to find the path to GCC, looking like /opt/homebrew/Cellar/gcc/13.2.0/bin/gcc-13. Modify the “CC” variable of Makefile to CC = gcc-13. And also add two lines to specify the path of library and header directory installed by homebrew: LDFLAGS += -L/opt/homebrew/lib and INCLUDE += -I/opt/homebrew/include.
    • Compile dcamprof by run make. Then install by run make install.
  4. Convert the calibration target photo to TIFF:
    • Though you can do it manually in RawTherapee, but personally I prefer to do the conversion with dcraw (an amazing single file decoder written in C, developed and maintain by Dave Coffin since this day 26 years ago, and supports hundreds of digital camera’s raw format) in a simpler way. Install the dcraw with homebrew by run brew install dcraw, and convert the *.nef to *.tiff by run dcraw -v -r 1 1 1 1 -o 0 -H 0 -T -6 -W -g 1 1 Ref.nef. The output image will look dark and green, because A. it uses linear gamma, and B. the camera sensor is more sensitive to green light.
  5. Generate *.dcp profile with Argyll CMS and DCamProf:
    • Argyll CMS can be installed with homebrew by run brew install argyll-cms
    • Go into the directory with the calibration target photo and run scanin -v -dipn Ref.tiff /opt/homebrew/Cellar/argyll-cms/3.1.0/ref/ColorCheckerHalfPassport.cht /opt/homebrew/Cellar/argyll-cms/3.1.0/ref/ColorCheckerHalfPassport.cie Ref-diag.tif
      A target information file “Ref.ti3” will be generated.
    • Generate the profile data by run dcamprof make-profile -I 5300K -C Ref.ti3 Ref.json Adjust the color temperature according to your lighting condition.
    • Generate the *.dcp profile by run dcamprof make-dcp -n "Nikon D5300" -d "Nikon D5300" -t acr Ref.json "Nikon D5300.dcp"
    • For Adobe Camera Raw (used by Lightroom and Photoshop), copy the generated *.dcp file to /Users/yiming.chen/Library/Application Support/Adobe/CameraRaw/CameraProfiles. For automatic camera matching in RawTherapee, copy it to /Applications/RawTherapee.app/Contents/Resources/share/dcpprofiles, or apply the profile in Color Management manually when you process the raw photo.
Calibration Taget Photos
Photo of calibration target with camera profile and calibrated profile, look slightly different (and should not be hugely different).

Author: armadillo

傻傻的笨蛋,什么都不懂的Small Kids,总是在幻想,轻轻地走来,静静地站在那里,默默地看着一切,细细地思考,然后悄悄地离开……永远都不愿意留在这里……You mustn't allow yourself to be chained to fate, to be ruled by your genes. Human beings can choose the kind of life that they want to live. What's important is that you choose life... and then live.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.