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).

2023 Best Nine

The post features personal travel preferences and destinations including Spirit Island in Maligne Lake, Alberta, Canada; Shinjuku, Tokyo, Japan; Pyramid Lake, Alberta, Canada; Half Dome, California, US; Two Jack Lake, Alberta, Canada; Grassi Lake, Alberta, Canada; Fujiyoshida, Japan; and Tunnel View, California, US.

纯凭个人喜好选择。

Spirit Island in Maligne Lake, Alberta, Canada.

Shinjuku, Tokyo, Japan

Pyramid Lake, Alberta, Canada

Half Dome, California, US

Two Jack Lake, Alberta, Canada

Grassi Lake, Alberta, Canada

Fujiyoshida, Japan

Tunnel View, California, US

Fujiyoshida, Japan

赶在2024年到来之前

赶紧发几张2022年的照片。

Continue reading “赶在2024年到来之前”

UC Berkeley的松鼠

基本都是Fox Squirrel。经常可以看到有大爷大妈提着整袋的花生喂它们,也经常看到被惯坏的松鼠看到有人来便跑过来拉着鞋带要吃的。

 

l1010124 l1010133 l1010942 l1010951 l1020024 l1020029 l1020414 l1020423 l1020436

Berkeley, CA

l1020303 l1020362 l1020363 l1020365 l1020414 l1020423 l1020436 l1020464 l1020481 l1020482 l1020485 l1020499

自己动手做豆腐脑

1. 背景信息

豆浆主要成分是大豆蛋白提取物,其中蛋白质以溶液或胶体形式存在于水中。新鲜豆浆的pH大约在7.4-7.9之间,呈弱碱性;而豆浆中蛋白质的等电点pI大约是6.0-7.0,因此可以通过添加弱酸调节豆浆pH使其中的蛋白质凝固,形成凝胶状固体,即豆腐脑。
为了保证豆腐脑的口感,防止蛋白质凝固沉淀速度过快,一般使用均匀缓慢的酸化剂,比如D-葡糖糖酸δ-内酯(D-Gluconic acid δ-lactone,又名Glucono delta-lactone, GDL, E575,结构见图一)。GDL是中性分子,但会在热水中快速水解生成葡萄糖酸(gluconic acid),后者呈酸性可以用来均匀酸化豆浆。
豆浆呈弱碱性,其中蛋白质带负电荷,因此悬浮在豆浆中的蛋白质胶体颗粒因为同种电荷相互排斥,因此胶体可以稳定存在;在豆浆酸化过程中,蛋白质胶体颗粒所带的负电荷被逐渐中和,因此中性胶体颗粒可以互相接近,其中的蛋白质聚集凝结,这就是豆腐脑制作的基本原理。

glucono-delta-lactone-2d-skeletal
图一 D-葡糖糖酸δ-内酯的结构。

2. 具体步骤

a. 泡发大豆:取干大豆2-cup,加入3-cup水,浸泡5小时,直到大豆泡发到体积约4-cup(如图二)。

图二 左:泡发前的2-cup干黄豆;右:泡发后的黄豆。

b. 打碎:将浸泡大豆的水倒掉,每2-cup泡发后的大豆添加3-cup水,用blender中速将大豆打碎,一般只需要30秒左右(取决于大豆总量以及blender转速,见图三)。此处不必将大豆打得太细,否则过滤速度将会非常缓慢。

l1020447
图三 打碎后的黄豆。

c. 过滤:用孔径较小的滤袋(最好是尼龙的比较耐压,实测大华卖的纱布滤网也可,只是用手挤压时不可过分用力否则很容易破裂,见图四)过滤,只留下豆浆。

l1020451
图四 用纱布袋过滤豆浆以除去豆渣。

d. 煮沸豆浆:用体积较大的煮锅(生豆浆体积宜少于锅体积一半),小火将豆浆煮沸。因为高温会导致豆浆中蛋白质变性粘度增大,需要注意控制火力防止锅底凝固烧焦或沸腾溢出。微沸数分钟后,将煮熟的豆浆放凉到80摄氏度左右(见图五)。

l1020456
图五 煮沸后的熟豆浆。

e. 添加凝固剂GDL:每1升煮沸后的豆浆,使用1克左右的GDL作为凝固剂。先将GDL完全溶于几毫升热水(见图六),然后将80摄氏度左右的熟豆浆快速倒入GDL溶液中。这一步顺序很重要!如果将GDL溶液加入热豆浆中,很可能因为局部浓度过高造成豆浆凝固不均匀。将混合好的豆浆静置几十分钟。

另外我还尝试按刀爷所说,用小苏打作为凝固剂。结果不论用量、豆浆温度,都观察不到豆浆有凝固现象。可能的原因是因为小苏打碳酸氢钠的pKb大于豆浆的pH和其中蛋白质的pI,因此无法中和电荷使蛋白质胶体凝固。

l1020452
图六 将GDL(每升熟豆浆使用1克)溶于热水中,放在容器里。

f. 成品:最终产品应为浅黄色凝胶状固体,纹理清晰可见,用勺舀起后仍为固体(见图七)。

l1020460
图七 凝固成形的豆腐脑。

3. 结论

本文讨论了如何使用家用Blender多快好省制作豆腐脑。按不同食用习惯,可以向制成的豆腐脑中添加蜂蜜糖水或葱蒜、榨菜制成的咸味浇头食用(见图八)。

l1000471
图八 上:添加蜂蜜、木瓜、猕猴桃的甜味豆腐脑;下:使用葱花、榨菜、蒜蓉、辣椒红油、酱油、盐调味的咸味豆腐脑。

致谢:要感谢LD做了最后那碗豆腐脑,以及品尝提出改进意见。