-k
parameter to make-profile command to control
compression of extreme range values.
cc24_ref-new.cie
.
-g
parameter.
nil-profile.json
in the data-examples
directory, useful when processing test images via test-profile when
designing looks.
2015-10-25
Version 0.10.1: hotfix for a rolloff bug in the tone reproduction
operator causing oversaturated skies among other things.
2015-10-23
Version 0.10.0, changes:
-y
,
typically used to limit blue channel subtraction to minimize the
strength of gamut compression required. This can have a strong
effect, use with care. Still the default value is set to -0.2 to
avoid generating unstable matrices on problematic cameras. Those
cameras will then per default render blues too light, but it's a
tradeoff. Read more in deep
blue handling.
-l
) is no longer what
it was, now it's used for LUT DE range specification. The old
behavior doesn't have any use as the thin plate splines are now
anchored to the gamut limit and regularization would relax
anchors too which would break gamut compression. Relaxation can
be achieved with the normal DE relax parameters.
-a
to make-profile). This allows
for powerful color corrections or subjective adjustments on the
colorimetric base profile, as a complement to optimization weighting
and the look operators.
-t
parameter.
-g
parameter to make-dcp and make-icc. With that
you can choose a gamut compression configuration without having to
write one in the tone reproduction operator configuration file.
-E
flag.
-D
flag.
-m
parameter of make-profile to import all
three matrices instead of just the color matrix. If you want to
import the color matrix only -p
is used instead.
target-mtx*.dat
. These can be useful when making
a matrix-only profile, or specifically targeting matrix optimization
with various weighting options.
-m
make-dcp parameter (copy illuminants to
avoid Adobe-style WB shift) will convert a single-illuminant profile
to dual-illuminant if the WB profile is dual-illuminant. This is
needed to make a perfect WB match.
-k
and -x
parameters to make-target
command for more flexible control of which patches to include and
exclude when merging patch sets.
This bug has been introduced sometime in the last versions, so until I've fixed this I recommend using version DCamProf v0.9.7.
DCamProf is new software and may contain serious bugs like this that I have missed in my testing. If you discover a bug like this I'm very grateful if it's reported back to me so I become aware of it and can fix it.
2015-09-14
Version 0.9.9, changes:
dcamprof -v
to get the version.
-m
parameter
for make-dcp.
-l
with negative parameters
(make-profile). This increases the relaxation effect a little.
-E
flag to match-spectra to force spectra as
emissive.
-m
parameter to make-dcp which can be used to
avoid avoid white balance shift in Adobe
Lightroom when you change from an old to a new profile.
-T
flag. This would be used for
raw converters that apply the curve after the ICC profile. I don't
really know if there exists any, but anyway if you would need it you
can now do it.
tc.dat
and tc-srgb.dat
)
-C
option to
make-target, make-profile and test-profile has now inverted
meaning.
-S
parameter to make-target, make-profile and
test-profile which enables rendering of virtual spectra if spectra
is missing in the target, this generally improves the performance of
the relighting transform.
-c
option for camera name was renamed to -n
to work in all
three commands.
-L
flag, which in some circumstances can reduce the
effect of glare.
-g
parameter.
-C
option to make-target, make-profile and
test-profile which causes the XYZ D50 reference values to be
calculated via CAT02 from calibration illuminant values, rather than
recalculated directly for D50 from spectra, useful if you want to
the profile to model color appearance differences between illuminants.
nve-lutd.dat
, a higher density grid useful when
zooming in plots of the native LUT.
'target-xyz.dat' pt 7 lc rgb var,
'target-xyz.dat' using 1:2:3:5 with labels offset
2
2015-05-17
Patch release 0.6.3. Fixed a plot bug introduced in 0.6.2. I also
adjusted whitepoint preservation handling, now the LUT (per default)
excludes patches close to the whitepoint, as the matrix is
whitepoint-preserving (neutral patches already optimized for as good
as possible) it doesn't make sense to stretch there. Added sign to
error tables on lightness and chroma so one can see if the color is
too light or dark or too saturated or desaturated. Added two more
error vector plots.
2015-05-16
Patch release 0.6.2. Added ICC support for test-profile, including
transfer function reversal, and also some ICC plots. Now ICC support
is as good as DCP support.
2015-05-13
Patch release 0.6.1. Fixed various ICC bugs, added possibility to
provide transfer functions which means Capture One ICCs can now be
generated. It's now also possible to make LUT ICCs. Test-profile
for ICC is still missing, but otherwise ICC support should be
complete. To read transfer functions a new dependency was added,
libtiff. The native LUT now applies whitepoint preservation.
2015-05-11
Here's 0.6.0. It's now possible to make ICC profiles
(make-icc
), matrix-only for linear pipelines only to start
with (-L
flag must be enabled). Added possibility to add a
tone curve when making a DCP. Extended profile format (can't use old
profile.json files, sorry). Added icc2json
and json2icc
commands. Added -I parameter
to make-target
so you can separate RGB and XYZ illuminants
also in that command. Increased parsing flexibility for Argyll-like
files (various CGATS), should handle patchtool files better.
2015-05-05
Patch release 0.5.4. Fixed bug in RGB/XYZ levels when merging several
targets, fixed a few Windows compile bugs. Now DCamProf supports
emissive spectra in the target files (added SAMPLE_TYPE column, "R" or
"E"). When merging targets the special patch "illuminant" and "white"
(new) is now always kept even if there are nearby patches.
2015-05-03
Patch release 0.5.3. Added possibility to read Argyll SPECT files
(produced by Argyll's illumread
) as illuminants. Now it's
possible to make dual-illuminant DCPs directly with
the make-dcp
command. When running the command without
parameters there is now a full list of exif light sources and their
temperatures, a useful list when choosing a suitable calibration
illuminant. Added a new command txt2ti3
to convert raw text
files with spectral data to .ti3 that make-target
can read,
useful when getting spectral data from various third-party sources.
2015-05-02
Patch release 0.5.2. A slight adjustment of observer remapping in
make-dcp and some update of observer documentation.
2015-05-01
New patch release 0.5.1. I hadn't tested on Lightroom properly. It was
shown that Lightroom cannot handle too high precision on matrix
rationals and it doesn't like if the standard observer WP is different
from 1931_2. I have now changed default observer to 1931_2 as it's an
easier to use default, and made an automatic remapping in the make-dcp
tool to handle the case when a different observer was used during
profile creation.
2015-04-30
Here's the first release of DCamProf to the public (0.5.0). This is an
early one, and while you can make camera profiles with it it's still in a
"hackish" state, probably some bugs left and certainly slow. There's
lots of silly loops over loops here and there. My excuse is that I've
been focused to get things working first rather than get stuck
optimizing for speed. As usual with these kind of projects it has
taken far more time than I initially planned, but then it's far more
feature-rich too!
To generate a camera profile you need either the camera spectral sensitivity functions (SSFs) or a measured target. DCamProf has no measurement functionality, but you can use the free and open-source Argyll CMS to get a .ti3 file with measurement data which DCamProf can read.
Here's a feature list:
The reason I started this software was that 1) Argyll can't do DCPs, and 2) I was not pleased with the commercially available alternatives for making own camera profiles. Too much hidden under the hood, too little control, and many indications that the quality of the finalized profiles was not that good. Then I added the SSF ability and the software grew to something more than just a profile maker, now you can say it's a camera color rendering simulator as well.
The software is quite technical, but if you can use Argyll you can use DCamProf. You can also find a separate tutorial of how to make profiles using DCamProf. It's supposed to complement the reference documentation found on this page.
DCamProf uses OpenMP to make use of
all your CPU cores in parallel. You can build it without OpenMP
(remove the -fopenmp
words from the Makefile) but some
aspects of the program will then run much slower as it will use only
one core. At the time of writing Mac OS X standard
compiler clang
doesn't support OpenMP (it's in the works
though), unless you build your own clang
from
source.
An alternative to building it on your OS X or Windows platform is simply to install a Linux virtual box and run it there, make sure you give the virtual machine access to all cores. An added bonus is then easy access to Argyll, gnuplot, exiftool and other related tools.
Temporary link: I currently don't provide own builds, but might do so in the future. In this forum thread you can often find recent ready-made builds (be sure to jump to the end and search backwards).
DCamProf assumes that the camera is linear, that is if you for example double the intensity of a certain spectrum the raw values will also double and there will be no change in their relation. This is indeed true for any normal digital camera today, with the possible exception of extreme underexposure and very close to clipping where there can be non-linear effects.
The linearity assumption leads to that the correction lookup table only needs to be indexed on chromaticity (that is saturation and hue, but not lightness), but the output still needs correction factors for all three dimensions as some colors can be rendered too dark or too light with a fixed factor throughout the full lightness range. That is DCamProf works with a LUT with 2D input and 3D output, commonly referred to as a 2.5D LUT.
DCamProf does allow you to apply a subjective look on top of the accurate colorimetric 2.5D profile. It will then use a full 3D LUT so you can make lightness-dependent adjustments, but the colorimetric part always stays 2.5D (well, except for some gamut compression of extreme colors, but that doesn't turn up in normal images).
This means that our linearity assumption breaks as the relative mix of camera raw values may differ slightly between dark and light colors and in this case a full 3D LUT could make a more exact correction. However, this only makes sense in highly controlled conditions when copying known media (such as printed photographs), that is when you're using the camera just like a flatbed scanner. The light source must be fixed, the camera exposure must be fixed, and the camera profile must be designed using a target made with the same materials as the objects you shoot.
As a 3D LUT only makes sense in this very narrow use case DCamProf supports only 2.5D (so far). If you really need a 3D LUT you can use Argyll, but you're then limited to ICC profiles. For strict reproduction work that may be a better approach.
Note that commercial raw converters often use 3D LUTs, not to achieve better colorimetric accuracy though but to make subjective "look" adjustments, which you also can do with DCamProf with its "look operator" functionality.
cc24_ref.cie
is for targets
produced before November 2014.
dcraw -v -r 1 1 1 1 -o 0 -H 0 -T -W -g 1
1 <rawfile>
scanin
command to generate a .ti3 file.
scanin -v -dipn rawfile.tif ColorChecker.cht cc24_ref.cie
scanin
command will generate a diag.tif
which shows patch matching (look at it to see that it matched)
and a rawfile.ti3 file which contains the raw values read
from rawfile.tif together with reference data from
the cc24_ref.cie file.
dcamprof make-profile -g cc24-layout.json rawfile.ti3 profile.json
-i
parameter, and
if the .ti3 lacks reflectance spectra specify its XYZ
illuminant using -I
.
cc24-layout.json
. If the target contains both
black and white patches glare will be modeled and reduced, and if
the target contains several white patches (not the CC24, but for
example a ColorChecker SG) it will be flat-field corrected.
dcamprof make-dcp -n "Camera manufacturer and model" -d
"My Profile" profile.json profile.dcp
dcamprof make-dcp -n "Camera manufacturer and model" -d
"My Profile" -t acr profile.json profile.dcp
dcp2json
and json2dcp
commands to do any manual edits of the DCP
file, such as changing profile name and copyright.
The steps that are the same as in the DNG profile case are only briefly described here, so look there if you need further details.
scanin
command to generate a .ti3 file.
scanin -v -dipn target.tif ColorChecker.cht cc24_ref.cie
dcamprof make-target -X -f target.tif -p target.ti3 new-target.ti3
dcamprof tiff-tf
command, but as
the make-target command can handle the tiff directly it's
generally not needed.
dcamprof make-profile -g cc24-layout.json new-target.ti3 profile.json
dcamprof make-icc -n "Camera manufacturer and model" -f
target.tif profile.json profile.icc
dcamprof make-icc -n "Camera manufacturer and model" profile.json profile.icc
dcamprof make-icc -n "Camera manufacturer and model" -f
target.tif -t acr profile.json profile.icc
dcamprof make-icc -n "Camera manufacturer and model"
-t acr profile.json profile.icc
There are also ICC raw converters that do no specific pre-processing, that is provide the ICC profile with "pure" raw input just like to a DNG profile, meaning that you can use the same native profile produced in a DNG workflow and make an ICC profile too. DxO Optics is one such raw converter.
In any case, you can assume that their bundled profiles have been optimized for the default curve and the others will provide somewhat sub-optimal color, although the difference is not huge.
If you like your DCamProf profile to work the same way, you do this way:
make-profile
command.
linear.tif
) and the other with the desired curve,
usually "Auto" or "Film Standard" (let's call
it curve.tif
).
dcamprof tiff-tf -f linear.tif curve.tif
tone-curve.json
dcamprof make-icc -n "Camera manufacturer and model" -f
curve.tif -t tone-curve.json profile.json
preliminary-profile.icc
modifier-curve.json
. Find
an example below.
dcamprof make-icc -n "Camera manufacturer and model" -f curve.tif -t tone-curve.json -t modifier-curve.json profile.json profile.icc
{ "CurveType": "Spline", "CurveHandles": [ [ 0,0 ], [ 14,8 ], [ 27,20 ], [ 115, 118 ], [ 229, 233 ], [ 255, 255 ] ], "CurveMax": 255, "CurveGamma": 1.8 }Capture One uses 0-255 as their range in the curve, and the curve works with gamma 1.8.
dcamprof make-target -c ssf.json -p cc24 target.ti3
dcamprof make-profile -c ssf.json target.ti3 profile.json
dcamprof make-profile -c ssf.json -i StdA target.ti3 profile.jsonNote that as SSFs are generally measured from real raw data without pre-processing, profiles generated from SSFs won't work for ICC raw converters that does pre-processing before applying the ICC.
DCamProf allows you to use any target you like though, you can even print your own and use a spectrometer and Argyll to get reference values. Although darker repeats of colors does not hurt there's not much gain from it as the LUT is 2.5D, so an IT-8 style target layout (many patches are just repeats in darker shades) does not make that much sense.
Dark patches are problematic as they are more sensitive to glare and noise (both in camera and spectrometer measurement), so an ideal target has as light colors as possible for a given chromaticity.
The profiling process requires at least one white (or neutral gray) patch. It's no problem if it's slightly off-white though. It should preferably also contain one black patch which should be the darkest patch in the target. This black patch is used to monitor glare. If feasible the "black" should be made as light as possible while darker than the darkest colored patch. If the black patch is significantly darker than the darkest colored patch we may detect a glare issue than in actuality only affects the black patch.
The white (and black) patches should preferably have a very flat spectral reflectance, as it makes glare monitoring more accurate.
Most targets have a gray scale step wedge which can be used for linearization. Digital cameras have linear sensors, but the linearity can be hurt by glare (and flare). Normally it's much better to reduce glare to a minimum during shooting than trying to linearize afterwards, as glare distortion is a more complex process than just affecting linearity.
(Semi-)glossy targets, such as X-Rite's ColorChecker SG, are extremely glare-prone and therefore hard to use. They cannot be shot outdoors, but must be shot indoor in a pitch-dark room with controlled light. Due to their difficulty during measurement the end result is often a worse profile than using a matte target. I recommend to first get good results with a matte target before starting to experiment with a semi-glossy. Those targets often receive bad reviews simply because the users have not minimized glare when shooting them.
A note about X-Rite targets: due to regulatory and compliance reasons the colors where changed sligthly in November 2014, so all targets produced in November 2014 and later has slightly different colors than those produced earlier. This means that if you don't measure your target yourself you need to make sure you have a reference file that matches the production date of your target. These things can happen also for other manufacturers and they may not always be announced.
If you have the camera's SSFs you can use the built-in spectral databases (or import your own) rather than shooting real test targets. In that case you will probably want to select spectral data that matches what you are going to shoot, for example reflectance spectra from nature if you are a landscape photographer.
make-testchart
command you can make your own
target. Here's a workflow, showing making a target for an A4 sheet,
and using a Colormunki Photo for scanning the patches:
dcamprof make-testchart -l 15 -d 14.5,12.3 -O -p 210
target.ti1
printtarg
is going to generate.
printtarg
command:
printtarg -v -S -iCM -h -r -T300 -p A4 target
-r
flag, otherwise
Argyll will randomize the patch positions which can break
flatfield correction.
chartread -v -H -T0.4 target
scanin
later.
spec2cie -v -i D50 target.ti3 target.cie
target.cht
chart
recognition file and a target.cie
reference spectra file
which can be used in the profiling workflows.
Semi-gloss targets will get very high saturation patches, but those are difficult for the camera to match and it's hard to shoot those targets without glare issues, they may also be harder to measure accurately with the spectrometer if it has limited range (some consumer spectrometers start at 420nm) or issues with glare. Making a matte target may be better in practice, although you can't get deep violet colors in those.
Higher end test targets may be individually measured so you get a
CGATS text file with reference values, and Argyll's scanin
tool can use them directly. If you get a standard 24 patch Macbeth
color checker you probably don't have an individual reference file and
then a generic file like the one provided with DCamProf
(cc24_ref.cie) will have to do. Having the reflectance spectra
is strongly preferred over pre-calculated XYZ values, so do get that if
you can. The problem with pre-calculated values and no spectra is that
when changing illuminants the software cannot re-calculate XYZ from
scratch using spectral data, but must rely on a chromatic adaptation
transform which is less exact. It's also a higher risk for the user to
mess up by forgetting to inform DCamProf of which illuminant the XYZ
values are related to. If there's spectral data the reference values
are always re-generated from scratch to fit the currently used
illuminant, which is both exact and convenient.
If you have a spectrometer (usually designed for printer profiling) you can measure your target and generate your own reference file with spectra. Using Argyll you do like this:
chartread
(exclude the .ti2
suffix, for most Argyll commands the suffix should be excluded):
chartread -v -H target
spec2cie -v -i D65 target.ti3 reference.cie
scanin
tool.
printtarg
you can add the -s
(or -S) parameter to it to get the .cht file. If you haven't used
printtarg it's unfortunately a bit of a headache to make your own
.cht. You can use the scanin
tool as a help for that (using
the -g parameter), but it's quite messy with lots of manual
edits. At the time of writing I have not tried doing it myself and
as long as you're using a reasonable popular target there will be a
.cht file distributed with Argyll, and if you make your own using
Argyll you can make the .cht when calling printtarg
.
In some cases you could get the reference spectra in some format that
Argyll can't read directly. Argyll is delivered with a few conversion
tools to handle other common text
formats, cb2ti3
, kodak2ti3
and txt2ti3
. You
may be helped by making a dummy conversion using DCamProf, like
this: dcamprof make-target -p input.txt -a "name"
output.ti3
, and sometimes you may have to do some manual
edits in a text editor too to get it into a format Argyll accepts.
Avoid reflections from nearby colored surfaces that may distort the color of the light source. If shooting outdoor, shooting in an open space with someone holding up the test target in front away from the body is a good alternative.
I recommend to defocus very slightly so you won't capture any structure of the target patches surface and instead get fields of pure color. If your camera lacks anti-alias filter this also makes sure you get no color aliasing issues. Shoot at a typical quite small aperture, say f/8 if 135 full-frame.
Argyll's scanin
is sensitive to perspective distortion, so
try to shoot as straight on as possible, and correct any residual
rotation/perspective in the raw conversion.
If you know what you are doing you can push the exposure a little extra to get optimal "expose to the right" (ETTR) and thus as low noise as possible. But be careful, clipped colors will be a disaster in terms of results. I use to exposure bracket a few shots and check the levels in the linear raw conversion to see that there is no clipping.
Uneven lighting is a common problem in camera profiling. The typical recommendation is to make sure you have even lighting (at least two lights if not shooting outdoor) and shoot the target small in the center (to minimize vignetting). However, if you employ DCamProf's flatfield correction (the testchart-ff command) you can relax the even-lighting requirement quite a bit. Flatfield correction evens out the light with high accuracy, so you need only make sure all parts of the target has sufficient light to avoid noisy patches. Some halogen lights may have an outer rim of light of a different light temperature. This is not well corrected with flatfield correction, so make sure the target is at least lit with the same light spectrum all over.
Using fewer lights (maybe only one) and compensate with flatfield correction can be a smart strategy when shooting glossy targets, as it's easier to keep the rest of the room dark. Room darkness is very important to reduce glare which is a real issue with (semi-)glossy targets.
Glossy and semi-glossy targets allow for higher saturation colors on the patches, but are also more difficult to shoot as they produce glare. Glare is minimized by being in pitch-dark room and having the light(s) outside the "family of angles". If the target is replaced with a mirror you should only barely see the dark room and camera in it, certainly not any lights. Having a long lens narrows down the family of angles, and a projecting light source (like a halogen spotlight) and dark/black cloth around the target makes sure as little stray light as possible bounces around in the room.
Veiling glare is a lens limitation of how large dynamic range it can capture. It's typically between 0.3% to 0.5% for high quality lenses, the fewer lens elements and better quality coating the lower veiling glare. I thought I'd mention it as you may have heard of it, but compared to other forms of glare this is negligible so you don't need to worry about it. Do avoid lens flare though, that is the lens must be in shadow, use a lens hood and make sure you have no light sources towards the camera. Also make sure the viewfinder is closed tight so no light comes in that way.
If you shoot a glossy target be prepared that you can have issues with dark patches, as those are affected most by glare. Removing those from the measurement (using an exclude list to the make-profile command for example) can be a better way to solve the problem than trying to correct the measurement error in other ways. Due to the many difficulties with semi-glossy targets I recommend to simultaneously make a profile from a matte target so you have a profile to sanity-check against.
In theory a gray scale step wedge in the target could be used to
correct glare. With DCamProf you can enable "glare matching" in
the testchart-ff
and also directly in make-profile
to compensate glare-induced non-linearity. However, glare distorts
more than just linearity and in unpredictable ways meaning that any
linearization or glare matching will only help to some extent, so
don't rely on it. You can indeed improve results this way, but
it often ends up worse than just excluding the darkest patches (those
that are most affected by glare) from profiling. So the recommendation
with DCamProf is to reduce glare to a minimum, and keep an extra eye
on the performance of dark patches, and exclude them if they seem
problematic.
Both DCPs and ICCs make corrections on white-balanced data, that is you feed the profile with a white-balanced image. For DCPs it might seem that you don't as the "ColorMatrix" work on unbalanced image data (more on that later) but the actual color rendering is decided by the "ForwardMatrix" and the LUT which work on the white-balanced image.
Naturally this means that in order for the profile to make the "correct" adjustments it must be used with the exact same white balance as used during profile design. Which white balance is used during design? Per default DCamProf will re-balance the target such that the whitest patch in the target is considered 100% neutral (real targets usually differ 1-2 DE from perfect), which means that white balance picker on the whitest patch is the best balance. You can disable this (-B to make-profile) and then DCamProf calculates the optimal white balance automatically, which is when camera white matches the calibration illuminant reflected by a 100% perfect white patch, that is usually slightly different from the whitest patch in the target. In any case it's a picked white balance, not the "As Shot" camera preset balance (there is an ICC special case though where you can design a profile for a camera white balance preset).
A well-behaved profile, that is one with only small and wide area stretches in the LUT, will be robust against slightly different white balance so it won't matter if you set it a little bit off to get a warmer or cooler look for example. A profile which has strong and very localized stretches (not a good profile!) may make sudden strange color changes when you shift white balance. This is because if you change white balance you apply a cast on all colors, which means that the colors move to other start positions in the LUT, and will get corrections that was intended for other neighboring colors, and if there are strong localized corrections the result can become quite off.
Wouldn't it be better if the ideal profile white balance was applied first, then the profile, and then your own user-selected white-balance? Yes, if the illuminant would always be the same as the one used when shooting the target, but if you shoot outdoors that's not the case. And in any case that's not how raw converters work so you can't have it that way even if you'd like it.
The take-away message is that for ideal profile result you should always set the white balance to represent white as good as possible, and if you want to make a creative cast, for example a bluer colder look, you should ideally apply that look with other color tools rather than the white balance setting. However, many (most?) raw converters don't make it easy to apply a cool/warm look in a different way than using the white balance setting, so that's what we usually end up doing anyway. If you've made a well-behaved profile (which you should) that should not be any real problem. Yes, profile corrections will not be as exact as when used at its designed profile, but if you're creating a look anyway that won't matter.
The most robust profiles concerning white balance changes is a pure matrix-only profile (no LUT), as they are 100% linear.
If you instead of using the "As Shot" white balance selects a different one with temperature and tint, the ColorMatrix is used to calculate the corresponding white balance multipliers, at least for Adobe Lightroom (other raw converters may use a hard-coded white-balance model rather than using the profile-provided ColorMatrix). This means that if you change profile to one with a different ColorMatrix the temp/tint will in this case stay the same but the actual multipliers will change and thus the actual visual appearance, that is you get a shift in white balance.
A DNG profile contains the calibration illuminant as an EXIF lightsource tag, that is there is a limited set of pre-defined light sources to choose from. For a single illuminant DNG profile this tag is not used though, so it can be set to anything. If you provide DCamProf with a custom illuminant spectrum during profiling the resulting DCP will contain "Other" as lightsource tag, that is no information of what temperature the profile was designed for, but as said it's no problem.
However if you don't provide the spectrum and instead provide the completely wrong illuminant, say you shoot the target under Tungsten but say to DCamProf that it's D50, the calculated color matrix will be made against incorrect XYZ reference values and the resulting profile will be bad at estimating light temperatures. For single illuminant profiles that still won't affect the color correction though.
Dual-illuminant profiles is an exception. In that case you have two matrices, usually one for StdA and one for D65. Both these are then used to calculate the temperature and tint, and the derived temperature is then used to mix the two ForwardMatrices, that is if it's exactly between the 6500K of D65 and 2850K of StdA the 50% of each is used. This means that the temperature derivation has some effect on the forward matrix and thus some effect on the color correction. So if you intend to make a dual-illuminant profile it's required to provide a proper EXIF lightsource for each, and for the profile to make accurate temperature estimations the actual lights used during profiling should match the EXIF lightsource temperatures as well as possible. It doesn't have to be exact though as any reasonable camera should have similar matrices over at least some temperature range.
Note that a DCP profile cannot be made to "correct" white balance, that is change your "As Shot" white balance multipliers to something else. In some reproduction setups you may want to do that, and for this you need to use an ICC profile instead.
If you design your own profile with DCamProf and use it in Adobe Lightroom for example it's as discussed highly likely that you will get a white balance shift compared to the bundled profile. This doesn't mean that there is something wrong with your profile, but simply that your calibration setup and matrix optimizations did not exactly match Adobe's. If you want to apply your profile that previously used the bundled one with a custom white balance settings this white balance shift can be problematic though. Avoiding it is fortunately simple: just copy the color matrix from the bundled profile, which is possible directly in the make-dcp command. As the actual color correction sits in the forward matrix and LUTs, this change of color matrix will not affect your color rendition (except for the slight effect caused by the dual-illuminant mixing described earlier), you just get rid of the white balance shift.
Raw converters that use ICC profiles have some other method than using the profile to figure out a suitable temperature/tint to show in the user interface. It may be using some hard-coded ColorMatrix, some hard-coded preset values or other model.
Normally ICC profiles are designed to not affect the user white balance, so when you change profile to an entirely different one the white balance will still not change (except for tiny changes related to correction of neutrals). However ICC profiles can change the white balance if designed for that. One application could be to make an ICC profile that changes the camera's "As Shot" white balance to match a specific light source used in a reproduction setup. DCamProf can make such a profile if you instruct it to, as described in the make-icc reference documentation. This feature is unique to ICC, you can't make it with DCP as the DCP design prohibits white balance alterations by the profile.
This should be used as reference when evaluating accuracy of colors. However, it does look flatter than the eye experienced in the brighter real scene, which is a normal appearance phenomenon. This means that we need to apply some sort of curve even when we want a neutral realistic look.
DNG uses a hue-stabilized RGB curve (constant HSV hue) so it's better at retaining hue than a standard RGB curve (which most ICC-based raw converters use).
Intuitively one may expect this to be truest to the original, but as seen it looks desaturated. This is because in human vision color appearance is tightly connected to scene contrast, so if you increase contrast also saturation must be increased to keep the original appearance.
While some errors can be side effects of the curve, they're mainly deliberate subjective adjustments by Adobe's profile designers with the purpose to achieve a designed "look", like films had in analog photography. DCamProf's tone-curve operator intends to stay true to the color appearance of the original scene and leave subjective adjustments to the photographer.
Note that comparing all these pictures may be hard directly on this web page as color shifts slightly with viewing angle. To critically compare then download the files, look straight at them while flipping through them in an image viewer. The images were made during development so the result from the current may differ a little, but you should from these images get an idea what the typical differences are and how large they are.
A linear tone curve is the right thing for reproduction work, for example when we shoot a painted artwork and print on corresponding media. In this case the input "scene" and output media have the same dynamic range and will be displayed in similar conditions. However in general-purpose photography the actual scene has typically considerably higher dynamic range than the output media, that is the distance between the darkest shadow and the brightest color is higher than we can reproduce on screen or paper.
The solution to this problem since the early days of photography is to apply an S-shaped tone curve. In film the curve compress highlights and shadows about equal (a sigmoid curve), while in digital photography there's been a shift to compress highlights more than shadows, which also brightens the image about a stop or so as a side effect. This suits digital cameras better as it retains more highlight detail. The principle is the same though, that is increased slope at the midtones with compressed shadows and highlights.
The need to compress highlights and shadows is obvious (otherwise we would not fit the scene's original range on the lower dynamic range available on screen), but do we really need to increase midtone contrast? The usual explanation is that the output media has lower contrast than the real scene and thus we need to compensate to restore original contrast. While this can be said to be true for matte paper, a calibrated screen will produce appropriate contrast for midtones. It surely cannot shine as bright as the sun and (probably) not make shadows as dark as in real life, but midtone contrast is accurate. In typical workflows we create the image first for the screen and then make further adaptations for prints (screen to print matching is a separate and well-documented subject), so when it comes to camera profiles comparing with screen output makes most sense which we will do here.
If we increase the midtone contrast with our tone curve, we will exaggerate. For a typical curve type this is mainly seen as increased saturation, as increased contrast separates the color channels more which leads to more saturation. Okay, so this is wrong then? Well, it's not that simple. Let's say we display a shot of a sunny outdoor scene. Although midtone contrast on the screen can be rendered correctly, the overall luminance is much lower. This makes the Stevens and Hunt color appearance phenomena come into play, that is the brighter a scene is the more colorful (=saturated) and contrasty it appears. That is to make the displayed photo appear closer to the real scene we need to increase both lightness contrast and colorfulness, which an S-shaped tone curve does for us.
So then all is good with the tone curves applied by typical raw converters? No. In fact if we're into a neutral and realistic starting point it's sort of a disaster. Most converters apply a pure RGB curve which has little to do with perceptual accuracy. Lightroom and many DNG raw converters apply a slightly different RGB curve that reduces hue shift problems (HSV hue is kept constant), but it's still in most situations almost identical in look to a pure RGB curve. It varies between converters in which RGB space this curve is applied, which also affects the result. In Lightroom/DNG it's always applied in the huge linear ProPhoto color space, while in many ICC raw converters it's applied in a smaller color space.
Let's start with the RGB tone curve problems. It will increase saturation more than is reasonable to compensate for Stevens and Hunt effects, so you get a saturated look. You might like that, but it's not realistic. Another problem is that for highly saturated colors one or more channels may reach into the compressed sections in highlights or shadows and that leads to a non-linear change of color, that is you get a hue shift. Typically the desired lightening and desaturation effect (transition into clipping) masks the hue shift so it's not a huge problem, but it's there.
Then there is the color space problem. If the RGB tone curve is applied in a large color space such as one with ProPhoto primaries (like in the DNG case) one or more channels can be pushed outside the output color space (typically sRGB or AdobeRGB) so we get clipping and thus a quite large hue shift. Some raw converters partially repair this through gamut mapping (Lightroom does), but still there may be residual hue shift.
To battle the various RGB tone curve issues bundled profiles typically have various subjective adjustments to counter curve issues. For example the profile may desaturate high saturation reds to avoid color space clipping. Naturally this means that the same profile used with a linear curve will produce too little saturation in the reds. That is a profile must be specifically designed for the intended curve.
I think this is bad design. In fact one could argue that staying with RGB curves (and similar) has inhibited the development of good profiling tools and makes it unnecessarily hard to get natural colors in our photos.
It doesn't have to be this way, the RGB tone curve is legacy from the 1990s when its low computational cost was one of the reasons to use it. It can also be seen as a nostalgic connection to film photography. In the film days the film had to produce the subjective look too, so exaggerated contrast and saturation were desirable properties. This thinking has been kept in most raw converters today despite that we have all possibilities to start off neutral and design our own look rather than relying on bundled looks. The RGB tone curve produces a saturated look that many like to have in their end result, but as said it still doesn't work well for profiles that aren't specifically adapted for it. Using a DCamProf neutral linear profile and applying and RGB tone curve will produce a garish look.
In science the goal is generally to make an as exact appearance match as possible, for example if we have shot a scene in very low luminance level (at night) also the eye's night vision with its desaturated color is modeled. Modeling all aspects of human vision at the scene and at reproduction becomes complex and is still a very active area of research.
Current raw converters are not designed for this type of advanced appearance modeling and it's generally not what a creative photographer is interested in. For example, in night photography we typically want to make use of the camera's ability to "see" more saturated colors than our eye can.
There is a middle way though. While we do want to increase contrast and don't really mind that it will be more than realistic for scenes not shot in bright sunlight, RGB tone curve color shifts are not beneficial. That is the tone reproduction operator we want for general-purpose photography is a basic S-shaped tone curve just like in traditional photography but without color shifts. This middle way has not got much attention in the research world though. Once computers got powerful enough researchers moved away from the "simple" tone curve models into tone mapping.
While tone mapping is useful in many cases, it's better handled separately in practical photography. It doesn't replace the need of a tone curve-based operator, it's just a complement. There is no widely used "standard" operator with this property though, so I had to come up with an own for DCamProf.
This operator can be applied when generating a DCP or ICC profile so you can achieve the intended look in your raw converter.
It has the following properties:
ntro_conf.json
file in the data-examples
directory for a documented example (shows the default weights).
The operator makes no local adjustments, and as it's just a part of a camera profile it couldn't do that anyway. This means that only the curve is analyzed for contrast, and as an image can vary in contrast locally (for example a large flat blue sky has low contrast even if the curve is a steep S-curve) also the eye's perception of color vary a little over the image surface, and thus some areas may receive a bit too much saturation or too little. This is not a large problem, but something to be aware of when evaluating results.
The DNG profile LUTs are not as flexible as ICC LUTs, most notable is that you cannot alter grays, not increase saturation or change lightness (value). As the LUT work with multipliers on saturation it's logical that you cannot increase saturation from zero. However, it's not logical that value cannot be scaled. Some DNG profile implementations support scaling grays (as the LUT itself does support), but the public DNG reference code as well as Adobe's products ignore the value multipliers for gray and instead set them to 1.0, that is no change.
This means that you cannot implement a curve directly in the LUT, as grays cannot be darkened or brightened (which a curve requires). The workaround is to embed a tone curve (which can scale grays), predict the result of that curve and reverse the undesired aspect to get the intended result. This is how DCamProf does it. There is one potential problem though: it's not specified in the DNG specification how the tone curve should work, so there may be raw converters out there that does not use Adobe's hue-stabilized RGB curve variant and if so you will not get the desired output.
If you come across such a raw converter and want to use this tone reproduction operator, please let me know.
The LookTable will per default be gamma-encoded for the value divisions, this will make perceptually better use of the range (that is higher density in the shadows) meaning that the default 15 value divisions should be enough for most curves. Some older or simpler raw converters may not support the gamma encoding tag though, and if so you can disable it.
There are no readily available color science models top help us out here, so the only method at hand is to verify by eye.To do this you make a linear profile first that can be measured for accuracy and use that as reference. Then you copy an image so you have two versions one with the linear profile applied and one with the curve, and do A/B swapping. It's important to do swapping and let the eye adapt for a couple of seconds, if you would compare side by side the eye will be confused by the two different contrast levels displayed simultaneously.
Check that individual hues seems to be the same and look globally and see if saturation seems to match (if you look closely on one isolated color without seeing the global contrast, saturation should be a little higher for the curve profile).
A photograph with faces in it is one good reference point, as our eyes are very good at detecting subtle differences in skin tones. I also recommend testing a sunny outdoor landscape scene, where you can check if the applied contrast is suitable (that is look globally and get a feel if the scene looks as contrasty as in real life but without exaggeration). Check if the color of the blue sky seems right, hue shift of light tones is typical for simpler curves. I also recommend testing a photo with various high saturation colors which you can find in flowers naturally or as artificial colors for example in toys or sports clothing. High saturation testing is a bit difficult as you can run into color space clipping. Using a wide gamut screen will certainly not hurt in this case.
As mentioned in the description of DCamProf's neutral tone reproduction operator there are limitations with operators that can only apply a global adjustment without adjusting specifically for the image content (which all profiles must do). Keep this in mind when evaluating the result.
The goal DCamProf strives for is a neutral starting point even when a curve has been applied, and then you can subjectively add saturation to your liking in the raw converter.
A scene-referred camera profile simply means that the purpose of the profile is to correct the colors so the output represents a true linear colorimetric measurement of the original scene. In other words we want the XYZ values for the standard observer, or any reversible conversion thereof. That is what we in daily speak would call an accurate linear profile, which DCamProf makes per default.
An output-referred camera profile should instead produce output that can be directly connected to a screen or printer ICC profile and produce a pleasing output for that media. As discussed, for cameras this means in practice that there should be some sort of tone-curve applied to get a pleasing midtone contrast and compressed highlights. In other words if the camera profile converts to XYZ space, those XYZ values should already have the curve applied and also any other subjective adjustments.
It's true that the ICC standard is written such that it expects camera profiles to work this way. However, raw converters that use ICC profiles don't necessarily follows this intention. Some let the ICC profile make a scene-referred conversion, while some makes some sort of mix between scene-referred and output-referred (let it do subjective color adjustments, but not apply a curve), and only a few do it the ICC standard way and make the ICC profile fully output-referred.
While DNG profiles can be 100% scene-referred, they can also have a "LookTable" LUT and/or a tone curve which are subjective adjustments for output, effectively making the profile output-referred. Adobe's own profiles have these type of adjustments, and are thus output-referred. I think scene-referred vs output-referred is a bit confusing concept as DNG profiles supports both things natively and ICC profiles do it in practice depending on raw converter design.
To support all-around use of scene-referred profiles the raw converter must have a type of tone reproduction operator that can change contrast without distorting color, otherwise scene-referred will only make sense with the linear curve. Of the big name raw converters few (none?) have such an operator but instead require profiles to be adapted for a curve. This is why DCamProf supports applying its own tone reproduction operator directly in the profile; raw converters in general are simply not up to using scene-referred profiles with their internal tone curves.
However, a matrix profile made to match a matte target, such as the classic CC24, will most likely produce too low saturation of high saturation colors, and will thus produce a less garish look together with an RGB tone curve than a colorimetric LUT profile would (which can accurately reproduce high saturation colors as well).
It's generally not a good idea to try to get good match of high saturation colors for a matrix profile in any case, as that will reduce precision of the more important normal range of colors. That is a good matrix profile is generally a bit desaturated and therefor works okay (although not perceptually accurate) together with an RGB tone curve in most circumstances.
DCamProf does not provide any functionality to adapt matrix-only profiles for tone curves (unless you add a LUT on top which you can for DNG profiles), so if you intend to use your matrix profile with an RGB-like curve make sure you design it with not too high saturation colors.
This is not standardized and cannot be controlled by the camera profile. There should be no need to do so either, but it's good to be aware of this if you compare output of the same camera profile in two different raw converters. If the shot is over-exposed the raw converter itself may affect the look. Naturally if you lower exposure of a clipped image the raw converter's highlight reconstruction algorithm will affect the look, which also is outside the scope of a camera profile.
However, the eye is only approximately color constant, that is some colors will appear slightly different under the new light. In color science the chromatic adaptation behavior of the eye/brain has been tested with various psychophysical experiments where test persons match colors under different lights, in order to find "corresponding color sets". The corresponding color under a different light can be a different sample, which is an example of "color inconstancy".
These experiments have then served as basis when developing chromatic adaptation transforms, CATs, mathematical models of the human vision's chromatic adaptation behavior. A CAT thus models both the color constant and the inconstant parts of adaptation.
A CAT does the following: provided a CIE XYZ tristimulus value under a source illuminant, predict what the XYZ tristimulus value should be under a destination illuminant that provides the same color appearance. The illuminants are given as whitepoints, so the CAT does not need any spectral data.
In camera profiling a chromatic adaptation transform is needed when the calibration illuminant is different from D50. The reason for this is that the profile connection space is always D50 (for both ICC and DNG profiles), that is the color rendering pipeline in raw converters need the profile to output colors relative to D50, which then can be converted further to colors for your screen or printer.
If the profile is made for say tungsten light (StdA, 2850K) we then need to convert those XYZ coordinates to corresponding colors under D50. This can be made with a CAT, and the current best for these tasks is the CAT coming with the CIECAM02, CAT02. However, the CAT is still far from perfect. There are challenges concerning the accuracy of the experimental data they are based on, and the experiments also cover limited illuminant range (usually StdA to D65) and limited range of colors. In addition the CATs are designed with various trade-offs to make them easier to use mathematically. And finally, these transforms work on tristimulus values only, of both colors and illuminants. Any knowledge of spectral information won't contribute.
However some reference files provided with commercial test targets only have XYZ coordinates, and if we don't have a spectrometer to measure the target ourselves then we need to make a transform without having any spectra at hand.
This transform is not the same as a CAT. A CAT finds a corresponding color and models the color inconstancy aspects of human vision. However as human vision is approximately color constant many software applications use a CAT anyway when a relighting transform is called for, and there's not much else to do as the established color appearance models do not provide any other transform. There is no standardized name for the "relighting transform" which means that CAT is sometimes used in the literature also for this which causes some confusion. In this documentation "relighting transform" will be used.
With DCamProf there is a better alternative for relighting than using a CAT. If the reflectance spectrum is missing DCamProf can generate a virtual spectrum which matches the given XYZ coordinate, and that spectrum can then be lit by any illuminant. Of course the rendered spectrum will not exactly match the unknown real spectrum, but tests made on various sets show that for most colors this method outperforms both Bradford CAT and CAT02. Rendering virtual spectra often gets you within 1 DE from the correct answer, while the CAT is often in the range 2-4 DE.
With a CAT the only data to verify against is the correlated color experiments made, and CAT02 generally wins when it comes to the established models. However, as discussed all of these models are rather approximate, and the question arises that maybe they introduce more errors than they fix? A CAT02 conversion from StdA to D65 will have about 3-4 DE on average compared to the correlated color set experiments. Performance is probably not so good outside the StdA to D65 range as the reference experiments does not cover a wider range than that.
It would be most interesting to compare CAT with simple spectral relighting, as the latter is usually available when profiling. When using the relighting transform as a CAT we assume perfect color constancy, which indeed is wrong, but on the other hand the error will be no larger than the range of color inconstancy, which presumably is quite small. Unfortunately the correlated color experiments don't have spectral data so there is no way to make this comparison. What we can see though is that relighting is about 3 DE on average from CAT02, with up to 6-7 in saturated reds and yellow-greens.
From these results a fair guess is that a CAT is indeed better at predicting the color inconstancy aspects of human vision than just keeping perfect color constancy (that is do relighting from spectra), but also that relighting may be more robust and may have smaller appearance errors in some ranges.
DCamProf needs target reference values as illuminated by the calibration illuminant (= the light the target was shot under). Why? There are two reasons, one is to calculate the color matrix which is used in DNG profiles to estimate light temperatures, and the other is to know the color appearance under that light so we can using a CAT get corresponding colors for D50 (the profile connection space) which the color correction is made for.
As the reference file is often calculated for D50 a relighting is often required. If spectra is available in the target file this is done by spectral calculation and thus very accurate results is had. If spectra is missing a relighting transform has to be applied.
DCamProf also needs D50 reference values, as this is the profile connection space where the color correction matrix (the "forward matrix") and LUT work. If the actual look of the calibration illuminant should be retained we need to model also the color inconsistency aspects of human color vision and then a CAT is used, so we take the reference values calculated for the calibration illuminant and transform those to D50 via CAT.
With DCamProf you can if you want force color constant behavior and then D50 values will be calculated via relighting rather than CAT, assuming target spectra is available. If you are making a reproduction profile this is likely what you want.
Note that if we don't make a DNG profile, or we don't care about its ability to estimate light temperatures, and we rather use color constant behavior than using CAT, the reference values for the calibration illuminant won't matter.
Summary:
-C
flag), this case will not be
applied.
-C
flag),
relighting rather than CAT is used to get the D50 reference
values. As reference files typically contain D50 values to start
with relighting is generally not necessary.
-S
flag) in this situation as it
provides more accurate results.
-C
flag, that is disable CAT.
This is very similar to how color films worked, few films had very accurate color but instead different types of subjective color that could suit more or less well depending on subject. Contrast (tone curve) differed between films too. That is one can say that the commercial camera profiles builds on the film tradition. Although we with digital technology could design the look separate from the profile (using the raw converter adjustments, or a photo editor), the traditional way with preset looks is still alive and well.
It differs between raw converters how these subjective profiles are grouped. The illuminant selection (typically tungsten, flash and daylight) is not about subjectivity but about adapting the camera response to a light source, but it's often a part of the profile choice unless it's automatically derived from white balance (dual-illuminant DNG profiles have it built-in). Then there's often a subjective choice depending on intended subject, "portrait", "product" and "landscape" are common genres. Sometimes the tone curve is integrated into the profile (lower contrast for portrait, higher contrast for product and landscape), or you can select it separately. As the tone curve affects color appearance I think it's better to have it integrated in the profile, so you know the designer have had full control over the end result.
In any modern raw converter you can as a user make many different color adjustments, as well as contrast adjustments. So why should the camera profile make these adjustments? Wouldn't it be better if the camera profiles just was as accurate as possible and then you as a user would choose color and curve adjustments using the readily available tools in the raw converter?
Well, first there is tradition as we already discussed which probably is the strongest reason why profile design has stayed this way. Choosing a profile is like choosing a film which renders the scene with colors and contrast in some way you prefer. But it's also non-trivial to make these subjective color adjustments, which is another key reason to provide the user with presets. Profiles don't have simple global adjustments like pulling the saturation slider, instead there are subtle adjustments here and there, to make skin color look flattering, slightly increase separation in foliage etc. They may contain lightness-dependent hue adjustments ("hue twists") for example make shadows more saturated and cooler (bluer) and highlights warmer (redder). We also know that adjusting contrast will change color appearance in ways which can be difficult to compensate. The average user may not have the skill or interest to do these type of fine-tunings. Of course the raw converter could still separate look from the profile by having look presets it would apply on top of an accurate colorimetric profile (which I personally think would be a better design), but few if any raw converters work that way today.
In fact, few raw converters actually have adjustment tools that allows for making the typical fine adjustments you find in profiles. Capture One has the "Color Editor" which is useful for some of these tunings, but Lightroom for example is quite limited in this regard.
When it comes to companies that produce both cameras and raw converters like Phase One and Hasselblad (and well, most other camera manufacturers too, but medium format makers color rendition stand out at least in terms of reputation), the profiles with their subtle subjective adjustments are part of their trade secret that sells cameras. While the camera hardware does play a very important role in how colors are rendered, the camera profile makes the largest difference and is thus very important in differentiating from the competition. The camera makers would probably not like to put this responsibility on the user.
So the reasons we have these profiles are because it's tradition, it's a way for camera and raw converter makers to differentiate, and as it's quite difficult to make the subtle adjustments yourself, so to most it's just easier if you get a preset look from the profile.
Is this a problem? Shouldn't we have some adjustments for skin tones and other subjects? Well, it's up to you to decide. First it should be noted that the neutral tone reproduction operator already does some of the adjustments you would expect, overall saturation is increased, saturation is increased in shadows, dampened for high saturation colors etc. This is not to make a look, but to compensate the appearance changes caused by the contrast curve, and I'd say that this is the most important aspect of the "subjective" adjustments you find in the bundled commercial profiles too.
If you want further adjustments that actually changes the appearance of colors depends on what type of subjects you shoot, what type of workflow you have and how much control you want during the workflow. If you shoot portraits with caucasian people you will probably want to adjust many of them to contain less red, and maybe even out the hues. You'd probably want to make a bit different adjustments from time to time, but still you may be helped by using a profile that has some skin tone adjustments built in to give you a better starting point. In that case you may want a specific "portrait" profile.
Don't forget though that any subjective adjustment in a profile will be global, so if it for example adjusts "skin tones" it will change any skin-like colors even if on entirely different objects. If you instead edit in Photoshop or similar application there are selection tools to isolate actual skin in the frame so you can modify only that, which of course makes more sense but does require time-consuming post-processing work for each image.
Also note that skin tones vary a lot person to person, and also varies depending on light, make up, tanning etc. Naturally this means that a profile that's good for one type of condition may be less good for others. Still some commercial raw converters have one subjective look that is supposed to suit any subject (Hasselblad's "Natural Color Solution" for example). If the profile makes quite small deviations from accuracy it can work quite well, but it should still be seen as a compromise.
If you do apply heavy manual post-processing to achieve a specific look it probably doesn't make much sense to have a subjectively fine-tuned profile from start, as no trace will be left of the original look anyway. Then I would prefer to get a neutral starting point so I would have an accurate baseline to start from, so I actually know what appearance changes that have been made.
A profile with a designed look is of course put to best use when you don't make much adjustments at all, or just smaller adjustments. If you have hundreds of images from a wedding a profile with some skin tone optimizations would probably not hurt. Also if your raw converter lacks tools to smoothen skin-tones you may want a profile that does that for you. You may also simply like the concept of selecting a preset look depending on subject, like having a portrait, landscape and a product profile.
So if you want a neutral profile or one with a designed look depends mainly on how you want to work, and to some extent also on the capabilities of your raw converter.
Here's a few examples of subjective adjustments you can find in profiles:
When you develop your look it can be worthwhile to first produce a set of TIFF files of representative test images generated with other profiles you like (or don't like) so you have something to compare against.
In general, and especially when it comes to skin tones, I can recommend studying the subject of color correction. Not the least you will see things that a profile cannot and should not do, local adjustments, or adapting to conditions specific to the image. For example if a person wears bright colored clothing this can affect the tone of the skin, and naturally a profile that corrects for that will do bad in other conditions.
A general-purpose profile however needs to render gracefully into clipping and also handle "extreme colors" well.
What is an extreme color? I define this as a color that triggers a camera response that according to the profile corresponds to an impossibly high saturation.
When you profile the camera using a target, say a 24 patch matte color checker, a linear matrix will be created that matches those as well as possible and the match is then further refined with a non-linear lookup table (LUT).
Here's an example matrix for a real camera:
CIE X = R * 0.766 + G * 0.221 + B * -0.023 CIE Y = R * 0.267 + G * 1.016 + B * -0.283 CIE Z = R * 0.015 + G * 0.140 + B * 0.951A representation of the "human eye's response" (CIE XYZ) is put together as a combination of the camera's raw RGB channels. The matrix is those nine constants. Within the range of a matte target like a CC24 the match will be quite good, a LUT will only do small refinements to an already good match. We can see something interesting in the matrix though: look at the blue channel especially for Y (luminance) output. As the camera has a broader/higher sensitivity than the eye in the blue range we actually need to subtract blue to get a good match. This is typical, although the value in the example (-0.283) is a stronger negative factor than for most cameras (the example comes from a Sony A7r-II).
Say that we get a raw color with zero on red and green and maximum on blue, then we actually get negative CIE Y output from the matrix, which would be clipped to black. In theory this would not be a problem as any normal colors would not trigger such raw channel combination. The matrix was optimized for a set of real colors and none of those comes close to outputting a negative CIE XYZ component. However, you can come across colors that trigger "strange" raw response, such as artificial narrow band lights that you can see in nightly cityscapes. Artificial emissive light sources in general are often problematic, and the deep blue range is typically the worst.
In this extreme range the difference between the CIE XYZ observer and the camera raw values will be exaggerated and it will be impossible to create a linear match (a matrix) which at the same time makes a good match for normal colors, or even matches a wide range of different extreme colors. A non-linear (LUT) correction would most likely be unfeasible with strong and contradicting stretches. Simply put, it's not a good idea to try to make an accurate colorimetric match in this range.
If you use a matrix-only profile you will get negative values in the extreme range, and unless the raw converter has some special handling for this range it will be clipped flat, in the worst case to black but more common to a plain strongly saturated color with no tonality information left. This is perhaps the largest drawback of matrix-only profiles when it comes to general-purpose photography.
If you make an ICC or DNG LUT profile DCamProf will handle those extreme colors through gamut compression on the colorimetric profile level.
DCamProf's color-correcting LUT will only work within the range where the matrix produces sane output. Outside the valid matrix range a generic gamut compression becomes active. It's purpose is to retain tonality (varying tones) where the camera captures tonality rather than being "correct", as the profile and camera can't be correct in any colorimetric sense in that range anyway. Some clipping will still take place, but it's controlled and it doesn't kill tonality.
The reason some clipping must take place is to be able to make a reasonable "increasing" gradient from neutral to full saturation clipping. Although this clipping doesn't kill tonality, the optimal tonality would be retained if no clipping would take place. Unfortunately the only way to achieve this on some cameras (with extreme blue sensitivity) is to desaturate the whole profile so you get a "longer range" to play with. This can indeed be observed in some commercial profiles. I don't recommend doing this as it sacrifices performance in the normal range, but DCamProf allows designing this type of profile too. An example can be found in the section describing custom deep blue handling.
The output in the extreme range may differ slightly between an ICC and DNG profile due to the different types of LUTs the formats use.
Note that this compression always takes place and is separate from the
more configurable gamut
compression you can apply on top. The user-controllable gamut
compression is about reducing the gamut further, to say AdobeRGB or
sRGB. The amount of compression can be controlled though, with
the -k
parameter in the make-profile command.
The maximum gamut DCamProf will work with is the intersection between the observer locus and ProphotoRGB. This means that the Prophoto triangle has it's deep blue corner cut (as it's outside human locus), and some of the cyan-green of the locus is cut. This gamut can be further limited if the profile's matrix has a smaller output.
Cutting away some of the locus may hurt the applicability of DCamProf profiles in some scientific applications, but DNG profiles are already limited to Prophoto, ICC Lab LUT has some range limitations as well, and cameras in general cannot perform well in the extreme range so this is a deliberate design choice. This gamut limitation makes the tone reproduction operator and other aspects of the software perform better.
Another aspect of "extreme colors" is colors that are so bright that they clip. Looking at the matrix you can see that there are such combinations. Clipping is quite small though so it's not too hard to handle and doesn't require much tricks. However in the tone reproduction operator handling clipping can be a complicated task, depending on how it's implemented. In the old days when tone reproduction was simply a plain RGB curve, no clipping issues was introduced. However if you work in other color spaces and want to stay free of color shifts you will end up with more clipping issues as you can't just compress one channel more because it's closer to clipping (that will shift hue, just like an RGB curve). DCamProf's neutral tone reproduction operator faces this challenge, and solves them with various methods. At the time of writing it's a moving target so you'll have to turn to the source code to see how it ended up.
If you get a JSON format error of your hand-edited files it can be hard to figure out where it is, then you can use one of the online JSON validators like JSON lint.
scanin
tool. Note that the Argyll .ti3 format is rich in features and
DCamProf only cares about a subset of it. It expects to get RGB
measurement triplets matched with XYZ reference values, and possibly
(hopefully) spectral data.
DCamProf can also generate .ti3 files and will then add some columns specific to DCamProf. Files remain compatible with Argyll though as unknown columns are ignored.
The .ti3 format (or rather an even more reduced subset of it) is also used when you want to import spectral data when you make a target to be processed by camera SSFs. An example of this exists in the data-examples directory.
DCamProf can also understand formats similar to .ti3, such as files coming from Babelcolor's patchtool.
spotread
you can read ambient light to a
spectrum file, and this can be fed directly to DCamProf as an
illuminant.
txt2ti3
command (not to be mixed up
with Argyll's command with the same name).
dcamprof <command> [command-specific flags] <command args>If you run the binary without parameters you get a list of all commands and their flags. Run
dcamprof -v
if you just want to
check the version.
The basic workflow is:
make-target
command to render
values based on provided camera SSFs.
make-profile
. This will output a generic profile in
DCamProf's own JSON format.
make-dcp
or make-icc
.
dcp/icc2json
and json2dcp/icc
commands.
test-profile
command.
make-target
command to generate
new RGB and XYZ values based on your chosen illuminant and
observer. This requires the full spectrum of target patches, and to
make RGB values you also need the camera's SSFs. For convenience value
re-generation is supported also directly in the make-profile
and test-profile
commands.
Here follows a description of each command available.
dcamprof make-target <flags, with inputs> <output.ti3>Make a target file which contains raw camera RGB values paired with reference XYZ values, and (optionally) spectral reflectance. The file format is Argyll's .ti3, with some DCamProf extensions.
If you're using Argyll for measuring a target you don't need to use this command, but you can still use it to regenerate XYZ values with a different observer for example (this requires that the .ti3 file contains spectral data).
If you have your camera's SSFs you don't need to shoot any physical target, then you render the .ti3 file from scratch using this command.
Overview of flags:
-c <ssf.json>
, camera's spectral sensitivity functions,
only needed if you want to (re-)generate camera raw RGB values.
-o <observer>
, only required when (re-)generating XYZ
reference values from spectra, normally the default 1931_2 is a
good choice.
-i <target illuminant>
, only required when
(re-)generating RGB values from spectra (default: D50)
-I <XYZ reference illuminant>
, only required when
(re-)generating XYZ from spectra (default: same as target
illuminant)
-C
, don't model color inconstancy, that is use
relighting instead of a chromatic adaptation
transform.
-p <patches.ti3>
, include patch set, in Argyll .ti3
format. The file can be produced by Argyll, DCamProf or any other
software with compatible format. It can contain XYZ and RGB values,
and preferably it should contain spectral reflectance of the
patches too. If spectra is available the XYZ and RGB values are
re-generated when possible (unless -R
and/or -X
parameters are provided).
-a <name>
, assign (new) class name to previously included
patch set (-p). Class names is a DCamProf extension to the .ti3
format (that is Argyll files lacks it). Class-names are useful when
assembling a single target file from multiple spectral sources and
you want to weight them differently during profile making. See
documentation for make-profile
for further details.
-f <file.tif | tf.json>
, linearize imported RGB values
to match transfer function in provided tiff/json, generally only
required in some ICC workflows.
-S
render spectra for inputs that lacks it
-g <generated grid spacing>
, adjust the grid spacing when
generating spectral grids. The spacing is given in u'v' chromaticity
distance, default is 0.03.
-d <distance>
, minimum u'v' chromaticity distance between
patches of different classes (default is 0.02). If you mix different
spectral sources, for example greens from nature in one set and
greens from artificial sources in another which overlap, this can
lead to a messy-looking target and give contradicting optimization
goals for certain colors. DCamProf can handle contradicting spectra
well, but to keep the target cleaner you can use this parameter
(which is enabled per default, set it to 0 to disable). The patch
set listed first on the command line takes priority, that is
overlapping patches of later sets are dropped.
-b <distance>
, exclude patch if there is a lighter patch
with same chromaticity. Suggested chromaticity distance 0.004 (default: not
active). As DCamProf makes a 2.5D LUT darker patches with the same
chromaticity will not really add much value, so to clean up the
target you can choose to remove those. If kept they will be grouped
together with lighter colors used for average correction.
-x <exclude.txt>
text file with sample id to
exclude from output target, one id per line, or class and id (with
space in-between). This will not override the keep list (if provided).
-k <keep.txt>
text file with sample id to (force)
keep in the target after merge overriding other exclude
parameters. One id per line, or class and id (with space in-between).
-X
, -R
, don't regenerate XYZ/RGB values of imported patch
sets. Per default target values are regenerated to match chosen
observer, illuminant and camera SSF, if all required information is
available. This is usually the best, but if you for some reason want
to keep the reference values provided in the imported file use these
flags.
-n
, exclude spectra in output (default: include if all inputs has
it). Target which include spectra are more flexible as XYZ (and RGB)
values can be regenerated with a different
observer/illuminant/camera, but makes a larger file which is harder
to read. If you don't need spectra you can exclude it. Note that if
some of the inputs lacks spectra the output will not have any
either.
-r <dir>
, directory to save
informational reports and plots.
cc24
-- spectral reflectance of the classic Macbeth 24 patch
color checker
kuopio-natural
-- spectral reflectance of colors occurring in
typical nature in Finland, leaves, flowers etc.
munsell
-- spectral reflectance of the full 1600 patch Munsell
glossy patch set.
munsell-bright
-- subset of Munsell, only the lightest and most
saturated colors included.
Although not a full substitute to real measured data it can be used for experiments, test profile performance, establishing a baseline or filling out for areas where you don't have real spectral data. And indeed, a profile rendered completely from generated spectra will work, try if you like.
You can generate spectra along the chromaticity border of a gamut and optionally fill the inside with grid of patches. The samples are always made as light as possible (as high reflectance as possible) for the given chromaticity. Extremely saturated colors are by necessity narrow-band and will thus be darker than less saturated colors.
The gamuts available
are locus
, pointer
, srgb
, adobergb
and prophoto
. Add "-grid
" suffix, eg
"pointer-grid
" to create a grid. The grid spacing can be
adjusted with the -g parameter. Gamuts with extreme or even out of
human gamut colors like locus and prophoto will cause the spectral
renderer to fail producing spectra on some chromaticity coordinates,
this is normal.
Be warned that spectral data generation is very processing intensive. DCamProf uses OpenMP to process several patches in parallel on all available cores, but it can still take minutes to produce a grid, or even hours if it's really dense.
The DCamProf spectral generator strives for smooth spectra, and its result is thus a little bit more rounded than the Munsell patch in this example.
The separate command txt2ti3
(not to be confused with
Argyll's command with the same name) can be used to convert those raw
text files into .ti3 that make-target
can read.
The flags should be self-explanatory so just run dcamprof
without parameters to get the information.
Example: import text spectral data (here from Lippmann2000 found in the spectral databases section) and form a target where cc24 fills out where the imported data don't have patches:
dcamprof txt2ti3 -a "caucasian" -s 1 -f 400,700,2 \ Reflect_AllCaucasian_400_700_2nm.txt caucasian.ti3 dcamprof make-target -p caucasian.ti3 -p cc24 output.ti3
It's however also possible to specify emissive spectra, that is light sources or reflective objects with an illuminant reflected off them. If you want to define a transmissive object such as a backlit leaf, you specify it as an emissive spectra, like filtered light source.
In the .ti3 file the column SAMPLE_TYPE says "R" for reflective spectra and "E" for emissive. This is a DCamProf extension and is thus ignored by Argyll.
When you integrate these CMFs with a spectrum you get the corresponding CIE XYZ tristimulus value. That is the observer is key element in modeling what colors we see.
As there's no method to actually measure the signals the eye sends to the brain the CMFs have been derived based on results from color matching experiments. The precision is thus dependent on the color matching skills of the people involved in the experiment.
The original observer was published as early as 1931, and it's still the number one standard observer. This is not because it's the most exact one, but because the CIE standard organization will not accept new standards unless significant improvement is made. Some minor improvements have been made over the years, but the original 1931 standard observer holds up well enough.
There are 2 and 10 degree variants of observers. This simply refers to how large area of the eye the tested color patch covers. With the more narrow 2 degree angle the eye is slightly better at color separation, but the 10 degree generally matches real situations better. The 1931 is a 2 degree observer, and the first standardized 10 degree observer was published in 1964.
DCamProf contains a number of observers, you can see a list when running the command without parameters. I'd like to use the 2006 observer as the default one as it's more accurate than the original 1931, and I'd also rather use the 10 degree observer as I think it matches real situations better than the 2 degree. However, as most color management software expects a 1931_2 observer and all the common color spaces sRGB, AdobeRGB, Prophoto are defined with a 1931_2 observer I've chosen that as the default. Only experiment with changing observer when you have full spectral information though, as changing observers will change XYZ values slightly so you can't have a reference file with XYZ values for a different observer for example.
If you change observer note that evaluation of profile-making results must be made with the same observer otherwise you will get larger Delta E than you should.
To get desired results with a different observer one needs at some point transform to colors for the 1931_2 observer as both DCP and ICC requires that the profile provides colors relative to that. Currently this transform model is very simplistic in DCamProf so the results will probably not be as good as they could be. Therefore it's currently best to stay with the default 1931_2 observer.
dcamprof make-target -I D65 -p argyll.ti3 output.ti3Generate targets files from scratch using camera SSF and built-in database:
dcamprof make-target -c 5dmk2-ssf.json -i StdA -I D50 -p cc24 output.ti3 dcamprof make-target -c 5dmk2-ssf.json -i StdA -I D50 -p cc24 \ -p munsell output.ti3Use the spectral generator to make targets from scratch:
dcamprof make-target -c 5dmk2-ssf.json -i 7500K -I D50 -g 0.01 \ -p pointer-grid output.ti3 dcamprof make-target -c 5dmk2-ssf.json -i D65 -I D50 -p pointer \ -p srgb-grid output.ti3Generate a border around the Pointer's gamut and use the reserved word "illuminant" to get the spectrum of the illuminant (D65 here) into the patch set, which is necessary as with only the border there would be no white patch:
dcamprof make-target -c 5dmk2-ssf.json -i D65 -I D50 -p pointer \ -p illuminant output.ti3...and then we do the same thing by using the reserved word "white" to get a perfect white reflective spectrum, which really is smarter as the reflective white will still work if we later change the illuminant:
dcamprof make-target -c 5dmk2-ssf.json -i D65 -I D50 -p pointer \ -p white output.ti3Re-generate both RGB and XYZ values from a previously created file which contains spectral information, use D65 for the RGB values and D50 for the XYZ values:
dcamprof make-target -c 5dmk2-ssf.json -i D65 -I D50 -p input.ti3 output.ti3Assemble a target from imported spectra and built-in database:
dcamprof make-target -p input1.txt -a "class1" -p input2.txt -a "class2" \ -p cc24 output.ti3Note that in this last case there is no SSF provided and while the input text files might have RGB values, no RGB values can be generated for the built-in cc24, and the output will thus contain dummy values (zeroes) for the RGB triplets. That is to be used when making a profile you need to run it through again to re-generate RGB values with provided camera SSFs. For convenience the make-profile and test-profile commands support re-generation directly so you usually don't need to re-generate reference values separately with the make-target command.
If you are using Argyll source files it's preferred that you include spectra throughout the workflow so XYZ reference will be re-generated with the observer chosen in DCamProf. If the XYZ reference values comes without spectra from a source you cannot control it's important to know which illuminant (and observer, nearly always 1931_2) that was used so you can later inform make-profile of that.
dcamprof make-profile [flags] <input-target.ti3> \ <output-profile.json | .icc | .dcp >Make a camera profile based on an Argyll .ti3 target file, either generated by Argyll from a raw test target photo, or by
dcamprof make-target
. The target file contains test patches
with raw RGB values from the camera coupled with reference CIE XYZ
coordinates of the patches, and possibly also the spectral reflectance
of each patch.
The output is written in DCamProf's own native format, which can be converted later on, or if you satisfy with default conversion flags you can directly write a DNG or ICC profile.
Overview of flags:
-n <camera name>
, optional camera name. If you
write DCP directly it's important to set it.
-w
, -W
, -l
, weighting to control
trade-off between smoothness and accuracy, described in a
separate weighting section below.
-a <target-adjustment.json>
,
apply target
adjustment configuration, can be used for subjective adjustments
but is mainly intended as a powerful way to control the matrix and
LUT optimizers.
-y <Y | X,Y,Z>
smallest allowed Y (or X,Y,Z) row
value in forward matrix optimization (default: -0.2 on Y only). This
is typically used to avoid "unstable" matrices with large negative
factors, typical on blue on some cameras. The default value limits
such cameras, but also causes them to render blue a bit too
light. See the section on deep
blue handling for details.
-k <LUT compress factor>
, decides over how long range
the out-of-gamut linear matrix values should be compressed at the
raw level before being handled by the LUT. If set to 0 no
compression will take place. The value represents the uncompressed
range, so if it's 0.7 it means that 70% of the range is uncompressed
and in the remaining 30% (compared to the gamut limit) the full
range up to raw clipping is compressed to fit withing gamut. Default
value is 0.7, and there's normally no reason to change it.
-d <distance>
, minimum u'v' chromaticity distance between
patches when optimizing LUT, default 0.02. Close patches will be
grouped together and an average correction is made.
-g <target-layout.json>
provide target layout for
glare matching and/or flatfield correction.
-o
, observer, default 1931_2. If target XYZ values are not
re-generated (that is the target lacks spectra) this must match the
observer used when the XYZ values was originally generated. If not
known the best guess is generally 1931_2, that is the default.
-c <ssf.json>
, camera's spectral sensitivity functions,
only needed if you want to regenerate camera raw RGB values from
spectral information in the target file.
-i <calibration illuminant>
, this is the illuminant the
target was shot under, that is the illuminant the target file RGB
values was generated for. Can be specified as an exif light-source
name or number, xy coordinate, XYZ coordinate, a spectrum.json
file or an Argyll SPECT file (produced by
Argyll's illumread
. To allow any target value re-generation
from spectra it must be a source with known spectrum. If camera SSF
is provided (-c) RGB values will be re-generated.
-I
specifies the illuminant for the XYZ reference values. Can be
specified as an exif light-source name or number, xy coordinate, XYZ
coordinate or a spectrum.json file. If spectral information is
provided in the target the XYZ values will be re-generated according to
chosen illuminant (and observer) when possible, and then this
parameter is thus ignored. If there is no spectral information it's
however important that the illuminant and observer matches what was
used for the target.
-C
, don't model color inconstancy, that is use
relighting instead of a chromatic adaptation
transform.
-S
render spectra for inputs that lacks it
-B
, don't re-balance target so most neutral patch
becomes 100% neutral. Per default the target D50 XYZ values used for
color corrections will be remapped slightly such that the whitest
patch in the target equals 100% neutral (in reality they usually
differs 1-2 DE), this means that the ideal white balance for the
profile will be the same as picking the whitest patch which is what
most will expect. By enabling this flag there will be no re-balancing
and instead the ideal white will be the true white, that is
typically 1-2 DE different from the white patch. This is more of
mathematical interest than having a real visible effect.
-b <patch name or index>
, manually point out most
neutral patch in target. Per default DCamProf will search and find
the most neutral among the lightest patches in the target, in some
cases it may not be the lightest white but maybe a neutral gray
below. If you want to make sure it picks a specific patch you can
specify it with this parameter.
-x <exclude.txt>
, text file with sample id to
exclude from target, one id per line, or class + id. The purpose
of this file is to make it simple to remove possibly problematic
patches and re-generate the profile to evaluate changes.
-p
, -f
, -e
, -m
,
pre-generated matrices if you want to skip the matrix finder steps.
-s
, run an alternate (much) slower matrix optimization
algorithm which can find a little better result. This
is extremely slow and mainly intended for a last resort
fallback if it seems like main matrix optimizer fails. It should
thus normally not be used.
-t <linear | none | acr | custom.json>
embed a
tone-curve in output DCP or ICC, and apply the default tone
reproduction operator. Will be ignored if the output is the native
format.
-L
, skip LUT in informational report. LUT is always
generated anyway, but if you intend to make a matrix profile in the
end it can be useful to show the DE report on the matrix only while
you do repeated runs tuning weights.
-r <dir>
, directory to save
informational reports and plots.
There are a few possible scenarios:
-S
flag. It cannot exactly recreate
the original unknown spectra of course, but if DCamProf has to perform
a relighting transform the results
will generally be more accurate than if not using simulated spectra.
In the most flexible case you have the camera's SSFs too. In this case also the RGB values are regenerated for the calibration illuminant you choose.
If you lack camera SSFs the RGB values from the file will be used
directly. It typically means that the file comes from
Argyll scanin
of your converted raw shot of a physical test
target and will by nature contain the RGB values for the light that
illuminated the test target at the time of shooting. In this case
it depends on use case if it's important that the calibration
illuminant you specify matches the real one or not, as follows:
-C
), that is enable 100% perfect
color constancy, the calibration illuminant does not affect the
result, except for the DNG aspects covered in the first bullet. That
is in this case it's purely informational.
DCamProf will need XYZ values for both the calibration illuminant and
the "profile connection space" which always is D50 (same for ICC and
DCP). A target file only contains XYZ values for one illuminant, and
thus the other or both must be calculated. If there is no spectral
information Bradford CAT will be used, which does not provide as
precise results as when calculating from spectra. With the -S
flag you can enable rendering of virtual spectra which often gives a
bit better result than using the Bradford CAT.
If you have spectra the XYZ values will be generated for the
calibration illuminant first, and then converted via CAT02 to the
profile connection space D50, and it that case it's of course
important that the calibration illuminant is reasonably truthful. The
purpose of using CAT in this case is to simulate the minor color
appearance differences that occur due to the illuminant. You can
disable this behavior with the -C
flag.
In any case if you shoot the target in for example outdoor daylight
you don't need to worry if you don't really know the exact
temperature, guess one of D50 (midday sunny) or D65 (midday
overcast). If you have a spectrometer you can bring a laptop and use
Argyll's spotread
to read the spectrum of the light and find
out what the correlated color temperature is so you get help to choose
the closest one. You can actually feed the actual measured spectrum to
DCamProf as well, which makes a difference if CAT is enabled, and will
make the color matrix as accurate as possible.
Here's the Argyll command to use to read the illuminant
spectrum: spotread -H -T -a -s
(If you run spotread
with -S
(capital S) you get a
spectral plot for each measurement which can be interesting. It's a
bit user-unfriendly though, the program may seem to lock up. You need
to activate the plot window and press space to get back to the
program.)
If you lack reflectance spectra in the target file the specified XYZ illuminant must match the ones used in the target. The values could for example originate from a target manufacturer reference file, and is then often relative to D50 or D65. Make sure to look it up so you can provide the correct one. Unlike the calibration illuminant this is really important that it's exactly right.
If you have measured the XYZ reference values yourself using a spectrometer you should have spectra in the target file. If not they have probably disappeared along the way, look over the workflow and see if you can provide DCamProf with spectral information.
If you don't provide any weighting parameters DCamProf will generate automatic weights to make some suitable tradeoff between smoothness and accuracy (the automatic mode tries to be on the safe side regarding smoothness and rather relax the profile too much than too little). For the casual user this is probably enough, but if you want the ultimate control you can tune them yourself.
You can control two aspects, one is the matrix optimizer and the other is the LUT optimizer.
To assign different weights to different groups of patches the target file must be split into "classes" (=groups of patches), specified through a "SAMPLE_CLASS" column in the file. The idea is that you can have a naming such as "skin", "forest_green", "textiles" etc and then for example assign greater importance to skin-tones.
Class names in the target file is a DCamProf concept and is not
available in Argyll-generated files. By running an Argyll file
through dcamprof make-target -p argyll.ti3 -a name
out.ti3
you can add a class column, and then edit the text file
manually and change names to split into more classes if you like. That
way you can split even a 24 patch color checker into several
classes. However, the main purpose of class-splitting is to be used
when you have a number of distinct patch sets of different spectral
types as you typically have when making a target directly with a
camera's SSFs.
If you don't have any class names (or all patches are in the same class) there's no value in providing a matrix weight. However the delta E relaxation for the LUT is still useful.
Finding the right weights is a trial-and-error process. For analyzing matrix results applying the profile to a colorchecker image brings you far. For the LUT dumping reports and plots (-r report_dir) and visualize the results is a good idea, see the section on report directory files for more examples. You can also look at the patch matching image files.
Let us start with discussing the matrix. This is the linear base for which the LUT applies non-linear corrections to. If the matrix is close to the ideal, the LUT needs to stretch less which makes it easier to manage. Relaxing the LUT makes gradients smoother and the result closer to the matrix. In other words it's a good idea to have the matrix close to your desired end result.
A matrix is by nature perfectly linear and thus have no issues with
gradients (smoothness). It can however be more or less precise, and be
more or less robust when it comes to extreme saturation
colors. Controlling the matrix optimizer through weights is pretty
crude, which is a side-effect of the mathematical optimizing process
itself which is difficult to steer in very specific directions. You
can split your target into classes and assign different weights to
them using -w
parameter. It's generally not that effective
for fine weighting, such as differing between several normal range
colors like preferring skin-tone precision over forest greens, the
matrix optimizer is likely to find some similar "best" anyway. It can
be more effective if you for example group high saturation colors
(from a glossy target) in one class and normal saturation colors in
another. For example you may want the matrix to be precise on normal
range colors and worry less about high saturation colors and then you
could set the weight to 0 for your glossy class.
DCamProf makes a pre-weighting per default (the user weighting is
added on top), this is to handle the situation when you combine
several patch sets with different density. Some patch sets may have
lots of patches concentrated around some specific color, and another
may have few patches widely separated. This is common when using
spectral databases. To not cause the dense sets to totally dominate,
there's a pre-weighting based on Delta E distances that normalizes all
patches. This is generally a good thing, but if you really want "1
patch = 1 unit" you can disable this normalization by adding -W. This
normalization only affects the matrix optimizer, the LUT optimizer
only looks at the max acceptable delta E deviations (specified with
the -l
paremeter). There is little reason to disable it.
If you have a simple target like the colorchecker 24, you will probably not do any matrix weight adjustments at all, as it doesn't really change much.
However, you can also control the smallest values in the matrix. As
discussed in the extreme colors section
a matrix which matches normal colors well may get strong negative
components and cause for example deep blues clip to flat blue or even
black. It can also be used as a crude way to lighten colors. Although
the LUT will counter-act and correct to get the same result regardless
of the matrix, when you relax the LUT you will get closer to the
matrix result. This smallest value is controlled with the -y
parameter. If you want to use it a typical start value could be
-0.1. Note that the matrix optimizer uses this as a guide, the actual
result can be slightly different (that is it may break the -0.1 limit
anyway). Read the section on custom
deep blue handling to get some further information on how this
can be used.
The default value of -y
is -0.2 and will thus limit the
matrix of some cameras. This can have a quite strong effect, nearly
always showing as a lighter blue (can be seen on the C01 deep blue
patch on a CC24). If you want to start off with an un-limited matrix,
which can be a good idea when you experiment with weighting, provide a
large negative like -y -5
to make sure the matrix won't be
limited. Note however that the default value is there for a reason,
cameras that are limited by this value is likely to perform in
unstable ways in the deep blue range if it's rendered "on the mark".
If you get the issue that the matrix optimizer perhaps make your red
colorchecker patch a little bit too magenta (probably due to a
tradeoff with other patches), you could in theory create a separate
class for that red patch and assign it a much higher weight. This is
however not likely to work well. If you want to achieve precise
hue-changing results of the matrix optimizer you should use
the target adjustment
configuration and simply reduce the magenta component of the reference
value, possibly exaggerate to get the desired effect. Adjusting the
target is normally not needed, but it's there for those that need
precise control of the matrix result. You may want to use target
adjustment only for the matrix, but not for the LUT optimizer. In that
case you need to design the matrix first, and the LUT later. You do
this by ignoring the LUT result first (use -L
parameter in
make-profile and make-dcp/make-icc commands), and when satisfied with
the matrix you store it in a separate file and provide that to a new
make-profile run with the -f
, -m
and -e
parameters.
Another powerful way to affect matrix optimization is simply to remove
patches. While you could cut it from the target file itself, it's
generally easier and more flexible to use the -x
parameters
and provide a list of patches to exclude. Again this affects also the
LUT optimizer, so if you only do this for matrix control you need to
do separate runs. Removing patches usually have quite strong effect on
the result, but quite hard to predict. I only recommend to remove
patches if you have those that seem problematic (bad measurement etc).
Now we're done with the matrix part. Let's go on with the LUT. For "casual" weighting you generally don't do anything with the matrix, but you do apply some generic relax on the LUT to improve overall smoothness.
A LUT can always stretch, compress and bend to match the target patches exactly, but that can result in sharp and even inverted bends causing ugly gradient transitions (typically most visible in photos with strong out-of-focus blur backgrounds when one color transitions into another). In this case it's better to relax the fitting, and the LUT optimizer will automatically relax in the best way based on the provided acceptable Delta E ranges (in CIEDE2000).
This is controlled with the -l
parameter and in the simplest
case you just specify one number, like -l 2
. This instructs
the LUT optimizer that an error of 2 Delta E is acceptable, and relax
the stretching towards the linear matrix either until reaching the
matrix or the error reaches 2 Delta E. If you set a very large number
the LUT will be able to relax so much it becomes identical with the
matrix result.
You can also specify this per patch class, in this case you specify
the name first and then the Delta E range(s), for example like
this: -l skintone 1 -l glossy 4
, assuming we have the class
names skintone and glossy. If you do such naming you should have names
for all patches so you can specify range for them all. Those that are
not named will be kept at 0 (stretch to maximum accuracy).
Instead of just providing one number you can specify the range exactly in all three dimensions in order lightness, chroma (saturation) and hue. For example this configuration:
-l -1,4,-3,2,1.5specifies that in lightness patches may be no more than 1 DE darker, but up to 4 DE lighter is okay; in chroma we say up to 3 DE desaturation is fine, but only 2 DE over-saturation, and hue range is specified only with one number and this is set to 1.5 DE in the example. Lightness errors are generally the least disturbing, easy to detect when doing A/B swapping tests but it doesn't look "wrong" if you just look at one picture isolated. However it can often be a good idea to not let patches become too dark as it will hurt tonality visibility, thus specifying a tighter range towards dark is a common strategy.
Most modern cameras have widely overlapping filters and are therefore naturally desaturated on the raw level. Pushing for more saturation is thus likely pushing the profile into more stretching. Over-saturated patches is also arguably more disturbing than under-saturated. Thus a chroma range with larger negative DE than positive is also a common strategy.
Generally we want hues to be as exact as possible, but if we don't provide any relaxation at all it will become hard for the LUT to relax also in the chroma direction, so setting some non-zero value is recommended.
You can disable correction alltogether on an axis, simply by setting very large DE values (say 100). Disabling the lightness axis is a common strategy as it suffers more from measurement errors and is more likely to disturb gradients than chroma and hue corrections.
Note that all this weighting stuff is only about matching the specific provided patches, the profiler can't magically make the camera work better. For example, if a camera is bad at separating green colors, it will still be bad even if the particular green patches in the target have been mapped correctly.
The forward matrix which operates in D50 XYZ space using D50 as the reference illuminant is not unique to DNG profiles, it's used for ICC profiles too. A matrix-only ICC profile can be said to contain a forward matrix. As the conversion from the calibration illuminant to D50 is needed by both profile standards DCamProf has adopted the forward matrix.
The color matrix is however DNG-specific, it's used for estimating the temperature and tint of the scene illuminant. It won't be used when generating an ICC profile.
Looking at DCRaw internals we find the color matrix again though ("cam_xyz" in DCRaw-speak), it's using a D65 color matrix per camera to render its default colors. So you can use DCamProf to contribute color matrices to DCRaw or other software that use DCRaw-style matrices.
There's also an additional matrix called "LUT Matrix". This is also DNG-specific and corresponds to the best (=least bad) ForwardMatrix that fits withing the ProPhotoRGB chromaticities. This typically means a matrix with very low saturation and overall light and dull colors, but with reasonably accurate hues. This matrix is used when generating a DNG profile with a LUT, and then it's used instead of the forward matrix, and the LUT is used to stretch colors into appropriate positions. The reason for this is purely format-technical: while DCamProf's native format implies gamut compression of negative values from the matrix output there is no such thing in the DNG format which just clips them. By using this special matrix premature clipping is thus avoided. This is not required by ICC (Lab) LUT profiles as there is no pre-matrixing in that case.
The most accurate correction is however had if you let DCamProf optimize towards a virtual 100% neutral patch, this will typically place the ideal white balance a little bit off the real target white. As it's only about 1-2 DE it's really only of mathematical interest it should not make a visible difference in any normal circumstance. If you want to do this you enable the -B flag.
Note that this only affects the forward matrix (which is used for the color corrections), the values used for color matrix calculation will not be re-balanced as it doesn't make sense; the color matrix is not used for color correction but only for figuring out the light's temperature and tint and thus re-balancing its data would only reduce its precision.
If you're working with SSFs and virtual targets you probably already have a perfect white in the target and then this setting will make no difference of course.
.ti3
file but if we work with spectra (like we hopefully do) it's not
really feasible.
Therefore DCamProf provides the option to provide a target adjustment configuration file in JSON format, a documented example is provided in the distribution. You can make global adjustments there without pointing out specific patches, but those will only take effect if there is an actual patch matching the changed area. If you have relatively few patches (like a CC24) the easiest way is generally to target individual patches.
In earlier revisions of the software the intention was to control the matrix optimizer with DE range specifications, like the LUT relaxation is controlled. However, due to the specifics of matrix optimization that method becomes much too unreliable and unpredictable. Adjusting the reference values works a lot better for this task.
So while you can make subjective adjustments this way, you could also do this to compensate some error in the process (maybe bad reference values), or if you just want to shift which colors the matrix optimizer matches best. If you're making a matrix-only profile in the end you make strong and "wrong" adjustments as long as the matrix optimizer result suits you. If you are using the LUT, the LUT will strive for perfect color match so then you don't want to have exaggerations in the target adjustment.
If you're into the subtle parts of custom looks, you should be looking to use look operators instead which is applied when you generate the DCP or ICC profile.
You can diagnose your camera's blue sensitivity in the resulting
ForwardMatrix: if the middle row value of the third column (raw blue
multiplier for CIE Y output) is less than say -0.15 your camera is
likely to have some issues in this range. To diagnose you need to make
sure the Y is not limited when making the profile though, by setting
the -y
parameter to a large negative value. It's set to -0.2
per default which means that problematic cameras will render blues too
light, but will get more robust profiles (the default is there to help
casual users).
There is another reason to handle blues in a custom way: the eye is not very sensitive in the deep blue range, so it's harder to see tonal variations in that range. Therefore many commercial general-purpose profiles render deep blues much lighter than they are experienced in real life, which makes tonal variations more visible, which may be a more pleasing result.
Normally these subjective "look" adjustments are made using look operators, which indeed from a design perspective is cleaner: that is you develop a a profile which is as accurate as possible in a colorimetric sense, and on top of that you make subjective adjustments. However from a practical processing perspective it's sometimes better to introduce some subjective adjustments already at the colorimetric stage. Limiting the blue range and render it lighter is one such case, and the reason is to minimize potential clipping and gamut compression in the base profile. If the colorimetric has strong compression in the blue range, it's hard to restore using a look operator. That is by lightening blue in the colorimetric profile we have a better chance to maintain optimal tonality in the range.
There are two ways to control the blues. 1) you can limit the range in
the matrix, forcing the optimizer to subtract less blue than it does
when optimizing freely (use the -y
parameter, for
example -y -0.1
). And 2) you can provide
a target adjustment
configuration file and lighten blue patches there. For the
classic CC24 the C01 patch gives good control of deep blue.
The eye is more sensitive to greens and reds and camera matching is less problematic there, so you generally don't need to make this type of handling of other colors.
Here's a real-world example for a Sony NEX6 which is problematic in the blue range:
dcamprof make-profile -y -0.15 -a adjust.json cc24.ti3 profile.jsonHere we have a target adjustment file too (adjust.json), we choose to make the blues a bit less red as it in this case makes the matrix even more robust:
{ "PatchAdjustments": [ { "Name": "C01", "ScaleRGB": [ 0.8, 1.0, 1.0 ] } ] }That is we've reduced red (0.8) of the deep blue patch (C01) in the CC24. If you're doing any hue adjustment of deep blue reducing red and/or increasing green (that is pull it away from magenta towards cyan) is often a good idea. Unstable deep blues that get a tiny bit too much red quickly becomes a strong magenta, which is very much a different color than blue. The transition to cyan is less consipicious and in terms of look it fits in there more natural looking like an "over-exposed blue".
What you will see is that there is no such thing as perfect result, and the farther from the white-point you get tougher it will be to compensate errors. While it can be fun to try to get a profile that works all the way out to the gamut limit it will hurt performance of common colors. It's generally better to maximize performance for colors you're actually going to shoot. Pointer's gamut approximates the limit of how saturated real reflective colors can be, colors outside that need to be represented by emissive (or transmissive) light like lasers and diodes. It's generally not worth-wile trying to get a good match outside Pointer's gamut. If you have the camera's SSF you can plot and see how well the camera can actually separate colors, you will probably see that there are some issues when it comes to extremely saturated colors, and no camera profile can compensate for that.
Consider that a perfect match to a specific color checker does not mean that the color precision is perfect, not even for those colors. It's only perfect for the particular spectra the color checker has, somewhat compromised by various measurement errors throughout the profile making process. Therefore I suggest to always apply some LUT relaxing to smoothen profiles at least some. As true perfection cannot be had, it's better to make sure color transitions are smoothly rendered.
If you see very large errors after matrix-only correction, say 10 DE or more, the LUT may get a too tough job and be forced to make extreme stretches than can make bad gradients and an unpredictable profile. One way to test a profile for robustness is to load it in a raw converter, show a color checker with many colors, and change white balance. If some color suddenly changes must faster than the others the LUT is probably making a strong local stretch at some point. Of course you can see this by plotting as well, but the white balance test is a good sanity check.
Modern cameras should get a decent match with the matrix alone, if you see large errors, such as 10 DE or more, it's likely that there is some wrong with your input data, such as poor lighting of the test target, glare, bad references values or reflectance spectra.
Make sure to check what the dynamic range test shows (printed in the console output when running make-profile). Example output:
Camera G on darkest patch(es) is 9.8% lighter compared to observer Y. Y dynamic range is 4.78 stops, G dynamic range is 4.64 stops, difference 0.14 stops. A small difference is normal, while a large indicates that there is glare.In the above example there's only 0.14 stop difference, and up to about 0.25 should be okay (that is very small effect on profiling result). By using the
-g
parameter and providing a target
layout description you can let make-profile model the glare to
compensate. This is usually a good idea, but don't expect perfect
results for high amounts of glare.
Note that you can only trust the dynamic range test result if the target has pure black patches. If the darkest patch is colored it's a large risk that the result is misleading.
Example 1: basic profile making with default parameters, using calibration illuminant StdA (calibration illuminant = the light source the target was shot under):
dcamprof make-profile -i StdA target.ti3 profile.jsonExample 2: assuming we have a target with cc24 and pointer border, we make sure the matrix is more focused on matching the cc24 (weight 1) than the pointer border (weight 0.5). This sets up the matrix for requiring less LUT stretch for normal colors. Then we specify the LUT max acceptable Delta E ranges, generally accepting less darkening than lightening, and less over-saturation than under-saturation, and requiring better precision of cc24 than pointer. We specifically allow the pointer border to be quite desaturation (-4). By providing camera's SSF (-c) the RGB values will be re-generated for the given illuminant (D65). Plotting data is saved to the "dump" directory (-r).
dcamprof make-profile -r dump -c ssf.json -i D65 \ -w cc24 1 -w pointer 0.5 \ -l cc24 -0.5,1.5,-1,0.5,0.7 -l pointer -2,4,-4,1,2 \ target.ti3 profile.jsonExample 3: make matrices using one target, and the LUT using another by running make-profile twice:
dcamprof make-profile -i D65 target1.ti3 m.json dcamprof make-profile -i D65 -m m.json -f m.json -e m.json \ target2.ti3 profile.json
dcamprof test-profile [flags] [target.ti3 | test.tif] <profile.json|.dcp|.icc> [output.tif]The test profile command is used to test how well a profile can match a specific target, or if you skip the target it will just run some diagnostics on the profile, or if you replace the target with a tif file it will pass the profile through that. The
output.tif
is
optional, if passed a test gradient or the processed input tif will be
stored there, otherwise in the report directory (if provided).
It will print a text summary on the console, for deeper information you should use the -r parameter to dump text files and plots. If you skip the target you should generally provide -r to get any useful information.
Overview of flags:
-o <observer>
, used if patch values are re-generated,
default 1931_2.
-c <ssf.json>
, camera SSFs, used to re-generate
target RGB values, or if you want to analyze the camera's color
separation performance.
-i <test illuminant>
, the illuminant the test is run under,
which per default is the same as the profile's calibration illuminant.
-I <target XYZ reference values illuminant>
, default is
same as the test illuminant. Only required if the target lacks
spectral data.
-C
, don't model color inconstancy, that is use
relighting instead of a chromatic adaptation
transform.
-S
render spectra for inputs that lacks it
-b
, -B
, white balance settings, see
make-profile for documentation.
-w <r,g,b> | m<r,g,b>
, provide camera
WB as RGB levels or RGB multipliers. Per default white balance is
derived from target, or when provided from the camera's SSFs.
-k <chroma delta>
adjust chroma of XYZ reference
values, see make-profile for documentation
-L
, skip LUT. If the profile has a LUT but you want to
test how it performs with only matrix correction enable this flag.
-P
, skip DNG looktable LUT. Only applicable to DNG
profiles, and only applicable to certain tests, in colorimetric
matching tests it's generally excluded anyway (if there is a
HueSatMap).
-T
, skip adding Adobe's default tone curve to DNG
profiles that lacks curve. Note that the colorimetric tests won't
use the curve anyway though as it doesn't make sense.
-f <file.tif | tf.json>
de-linearize RGB values in
target, that is run provided transfer function backwards. This is
only relevant for ICC profiles made for raw converters that apply a
transfer function, such as Capture One.
-r <dir>
, directory to save informational reports
and plots.
Anyway, if you instead want to test how the profile will match colors when the camera is set to a different white balance (such as a camera preset) you can provide a custom white balance via the -w setting.
It's given as a balance between red, green and blue, or as channel multipliers. To find out what multipliers a camera is using you can use exiftool on a raw file. White balance can be stored in different ways depending on raw format, it's out of the scope of this documentation to cover it in full. Anyway, in most cases it's some sort of multipliers, and often green is repeated twice, like this:
WB RGGB Levels Daylight : 15673 8192 8192 10727And then you simply provide "
-w m15673,8192,10727
" to
DCamProf, note the "m
" which say that we provide white
balance as multipliers rather than actual resulting balance between
the channels which is 1/m.
When DCamProf prints a white balance it will show the balance
normalized to 1.0, meaning that the above example is translated
to 0.52,1,0.76
.
To get a sane result you need a highly populated grid of patches to test with. I recommend to generate a locus grid, like this:
dcamprof make-target -c cam-ssf.json -p locus-grid -g 0.01 locus-grid.ti3This will take quite some time, but once generated you can reuse this grid with any camera since when you provide the SSF and illuminants the RGB and XYZ values will be regenerated from spectra:
dcamprof test-profile -r dump1 -c cam-ssf.json -i D50 locus-grid.ti3 \ any-profile.jsonTo get the plot you need to provide the -r parameter, and then the file is named
ssf-csep.dat
. You can plot it for example with
this gnuplot script:
unset key set palette rgbformula 30,31,32 set cbrange [0:300] plot 'gmt-locus.dat' using 1:2:4 w l lw 4 lc rgb var, \ 'ssf-csep.dat' pt 5 ps 2 lt palette, \ 'gmt-adobergb.dat' w l lc "red", \ 'gmt-pointer.dat' using 1:2:4 w l lw 2 lc rgb varWhat you see is a heat-map in a u'v' chromaticity diagram, here limited to 300 max. Each dot shows how much the camera signal will change in 16 bits (65536 steps) for 1 delta E change in chromaticity (= change in hue and saturation with constant lightness). No current camera is really 16 bit, this is just used as a fixed reference to get a number in a comfortable-to-read range. For this type of test you should not worry about a camera's dynamic range and read noise, shot noise will be the limiting factor.
A black dot means that the signal change is zero and thus the camera cannot separate color at that chromaticity location and no profile can ever change that.
The test is run against the target provided and it expects a dense grid-like layout of patches, if your target is coarse there can be misleading results. The locus grid generated in this example makes reflectance spectra, so the colors tested are all related to the illuminant, the colors are as light as the illuminant allows for that chromaticity. This means more saturated colors are naturally bit darker and thus harder to separate. However it becomes harder for the eye too. Often cameras will show good separation capability in the purple range, and that is partly because the eye is relatively poor at it. As the values are related to Delta E they will be related to the eye's capability (as modeled by the observer's color matching functions).
The diagram always shows values relative to a D50 white point. You can test with a different illuminant using the -i parameter. You will see the result changing, but note that the coordinates are always remapped to D50 in the diagram.
Note that the generated locus grid will not go all the way to the edge of the line of purples. This is because the line of purples is actually black (as it's at the border of the eye's sensitivity) so moving in a bit we get saner colors. The spectral generator can still have some issues to reach all the way to the locus and line of purples so you may get some gaps.
The unit of the heat map is how many 16 bit units (65536 steps) the camera raw signal changes if the color chromaticity changes with 1 CIEDE2000 unit. The test reflectance spectra is a generated grid related to a D50 illuminant, and is made as bright as possible for each chromaticity coordinate.
The darker heat (lower signal difference) the worse color separation, if it's zero the camera can't differ at all. For complete information of limits you need to relate to photon shot noise as well, which is out of the scope of this document. What we can see is that the camera gets problems towards the locus, mainly on the cyan side and towards the red corner. We also see it's good at purples, which is partly due to that the eye is not as good and thus it takes more distance to reach one delta E.
We can also see that the diagram is a bit "worried" and that we have a notable minima inside AdobeRGB towards the red corner on the purple side. Some odd minimas here and there and the messy look is typical, as the SSFs differs greatly from the observer's CMFs. We see a smoother behavior in the green area, this is because there all three SSFs are involved in producing the signal.
-r <dump>
a generated gradient TIFF file will be
dumped, first without any processing as gradient-ref.tif
and then
processed through the profile including the LUT(s)
as gradient.tif
. This means that the
content in gradient-ref.tif
corresponds to white-balanced
"raw" camera data, and the output is what that becomes when processed
through the profile.
The purpose of this is to diagnose the smoothness of the profile's LUT as a complement to plotting. Note that as the gradient goes through all combinations (with some spacing) there will be some "impossible" raw values too, for example maximum blue but no red and green output. It's quite common that a profile clips or make artifacts in those areas, but this is no problem as they will never appear in real images.
Dumping this artificial gradient image is also very useful for verifying the smoothness during design of a subjective look using look operators.
The RGB primaries in the output is ProPhoto, and an ICC is embedded in
the files. Beware that poor gradients and clipping is likely to occur
due to the screen's color management, so turning it off temporarily
when analyzing the more saturated parts of the image may be
worthwhile. Use the unprocessed gradient-ref.tif
as sanity
checking, if that has some banded gradient it's probably due to the
color management of the display.
dcamprof test-profile test.tif profile.dcp output.tifThe source image must be an 8 or 16 bit ProPhoto RGB image. The linearized data will then be seen as white-balanced camera raw data and put through the profile, and then saved to a new ProPhoto RGB image (
output.tif
).
One use for this is to test a look design on some specific
subject. Then you don't want to test the camera colorimetric profile
at all, just the look. To do this use the nil-profile.json
in
the data-examples directory to render an ICC or DCP:
dcamprof make-dcp -t acr -o look.json nil-profile.json test.dcpAnd then you run that through your test image:
dcamprof test-profile test.tif test.dcp output.tifThe test image should be a normal white-balance image without a curve and with ProPhotoRGB ICC profile. You can prepare it from a real raw file, just make sure you apply a basic profile without a curve and export to a 16 bit ProPhotoRGB TIFF.
The normal way to test a look is to apply a normal finished profile on a real raw file in the raw converter. An advantage of applying it to a TIFF file using test-profile instead is that you can merge several images into one to test several aspects of the look at once. You can also make artificial images, to test gradients or special hue ranges that are difficult to find in real images.
dcamprof test-profile -r dump -i StdA target.ti3 profile.dcpExample 2: test how well the profile will match colors with a camera white balance preset (found out via exiftool for example):
dcamprof test-profile -r dump -w m15673,8192,10727 -i D65 target.ti3 profile.jsonExample 3: disable the profile's LUT and see how well the matrix matches the target (note that some DCPs designed with other tools are made such that the matrix is very far from correct color and the LUT is required to get close):
dcamprof test-profile -r dump -L -i D65 target.ti3 profile.dcpExample 4: don't run any patch matching test, but only dump plots and reports:
dcamprof test-profile -r dump profile.dcp
dcamprof make-dcp [flags] <profile.json> [profile2.json] <output.dcp>Converts a profile in DCamProf native format to Adobe's DNG Camera Profile (DCP) which can be used directly in various raw converters. There's really not much to this command, generally you only run it with the -c flag to specify unique camera name.
Overview of flags:
-n <unique camera name>
, must match what raw converters
are expecting, provide within quotes.
-d <profile name>
, the profile name tag string,
used by some raw converters (like Lightroom) in the select box when
choosing profile to use, so come up with a name that makes the
profile easy to identify. If spaces in the string, provide within quotes.
-c <copyright>
, the copyright tag string. If
spaces in the string, provide within quotes.
-b <baseline exposure offset>
, optionally set the
baseline exposure offset tag.
-B
don't include the DefaultBlackRender=None tag,
meaning that some converters will then do automatic black level
adjustment. If you're a Lightroom user you're probably used to
automatic black level adjustment and may want it also for your
DCamProf profile, and then you should enable this flag.
-i <calibration illuminant 1>
, specify a
different calibration illuminant 1 than the tag found in the source
profile, useful if the source has "lsOther" and you're making a dual-illuminant profile.
-I <calibration illuminant 2>
, specify a
different calibration illuminant 2 than the tag found in the source
profile, useful if the source has "lsOther" and you're making a dual
-illuminant profile.
-m <other.dcp>
copy illuminant(s) and color
matrices from the provided DCP. Do this if you want your profile to
calculate white balance the exact same way as the provided
profile. This is useful if you need to avoid
a white balance shift.
-h <hdiv,sdiv,vdiv>
, hue and saturation divisions of
LUTs (default: 90,30,30). The value divisions is only used for 3D
LUTs. The 90,30,30 is more dense than usual and yields a large 3D
LUT (total profile becomes about 1.5 megabytes). The reason for this
default is that the 3D LUT is used by the neutral tone reproduction
operator and it needs a high density to work well as it counteracts
some of the look problems produced by the DCP tone curve.
-v <max curve matching error>
, used to
automatically calculate value divisions needed for the LookTable
when applying a neutral tone operator. The default should do.
-F
, skip forward matrix, will generate an old-style DNG profile
without forward matrix, this is not recommended but may in some rare
situations be necessary as some ancient software doesn't support
forward matrices.
-E
, don't use the special LUT matrix as forward matrix
in your LUT profile, but instead use the actual forward matrix. This
can be desired if you use it in a context where the LUT can be
disabled (like RawTherapee) and you need good colors even then. The
drawback is that extreme value handling will be worse as the matrix
clips, unless the raw converter has built in handling for that.
-L
, skip LUT (= matrix-only profile).
-O
, disable forward matrix whitepoint
remapping. Generally not a good idea to disable as it may render the
profile unusable in some DCP software.
-G
, skip gamma-encoding of 3D LUTs. This only applies
if a 3D LUT is used. Normally the value channel in the LUT is gamma
encoded as it better matches the eye's lightness sensitivity and we
get a better use of value divisions. It may lead to compatibility
issues with older/simpler DNG software though. If using this flag,
consider increasing value divisions to retain precision.
-D
, make the HueSatMap 3D instead of 2.5D. In general
this makes a very small difference but the profile considerably
larger.
-H
, allow hue
shift discontinuity between LUT entry neighbors. Most (probably
none) DNG pipelines doesn't support this so it's generally a bad
idea to allow it.
-t <linear | none | acr | custom.json>
,
embed/apply a tone curve. For colorimetric accuracy you should have
no curve, or set it to "linear" as some raw converters apply a curve
if the DCP has none. To apply a default film-curve, which may yield
a more pleasing look, choose "acr" which is the default curve by
Adobe and used by the DNG reference code. Note that the tone
reproduction operator (-o) will affect how this curve is
used. Default: "linear". Curves can be cascaded, that is
you can provide -t
more than once.
-o <neutral | standard | custom.json>
, tone
reproduction operator (default: neutral). Will only be applied
if a non-linear curve is applied (-t parameter).
-g <none | srgb | adobergb>
, gamut compression
presets. Will only be applied if a non-linear curve is applied (-t
parameter) with the neutral tone reproduction operator. You can
configure the gamut compression more precisely in
a tone reproduction operator configuration
file (-o parameter). Default: none (or from the configuration file
if any).
-r <dir>
, directory to save informational reports and plots
-h
parameter) which is a quite dense table and there's
little reason to change that. If you'd want to change it it's probably
to reduce the table size to get a smaller profile.
The DCamProf native LUT is spline-interpolated while a HueSatMap is linearly interpolated. This means that you may get smoother gradient transitions if you have a bit denser HueSatMap than needed for actual target matching. Therefore I think the 90,30 density is quite good to have even if the profile is based on very few patches.
If you dump plotting data with the -r
parameter you will get
data for the HueSatMap so you can visualize it. This is useful if you
experiment with the table density.
Example plot for comparing native LUT with HSM LUT (useful to see if you should adjust HSM table size):
splot \ 'nve-lut.dat' w l lc "beige", \ 'hsm-lut.dat' pt 1 lc "blue", \ 'gmt-prophoto.dat' w l lc "red", \ 'gmt-locus.dat' w l lw 4 lc rgb varThe HSM LUT operates in linear Prophoto RGB space, converted to HSV. This means that in an u'v' coordinate system it looks very dense close to the white point, and then becomes gradually less dense.
This means that it's not possible to get an exact match with a DNG
2.5D table. However the difference is very small, and also the gamut
compression from the extreme range will translate well (although
look slightly different) so therefore the HueSatMap is wisely kept at
2.5D. You can force it to make a 3D table though, using
the -D
flag.
dcp2json
and json2dcp
commands:
dcamprof dcp2json input.dcp dcp-profile.json
dcamprof json2dcp dcp-profile.json output.dcp
dcamprof make-dcp profile1.json profile2.json dual.dcpThe lower temperature illuminant should be listed first, and you must have illuminants with known temperature, ie you cannot have "Other" which the profile will have if you have used a custom calibration illuminant. If so, specify illuminants using the -i and -I parameters, set EXIF names that as close as possible matches the temperature of your custom illuminants.
Note that the light source temperature is the only thing that matters to DNG Profiles, it makes no difference if it's a fluorescent (peaky spectrum) or tungsten (halogen, smooth spectrum), so if your calibration illuminant was a 3500K halogen lamp, the EXIF light source "WhiteFluorescent" (3525K) is the best choice.
DCamProf makes no sanity check on your illuminant listing so if you use "Other" or place the highest temperature light source first the resulting profile may not work in your raw converter.
The most common dual-illuminant combination is StdA and D65. It generally makes little sense to combine say D50 and D65 as they're too close. The general idea of dual illuminant profiles is to make a generic profile that works in varied light conditions, and then you want to combine two light sources whose white points are relatively widely spaced. Look at the color temperatures plotted in a chromaticity diagram for example to get and idea of how much they differ.
If you want to avoid this you need to replace the color
matrix/matrices in your new profile with those found in the old, by
using the -m
parameter. As color matrices are only used for
whitepoint temperature calculations and no actual color corrections
this will not affect color rendition. The ability to predict white
point color temperatures is in full replaced by the old profile
though.
Per default DNG raw converters use a type of RGB curve that has some color distortion issues as discussed in the tone curves section. DCamProf can instead apply an own curve type (via 3D LookTable corrections) which is more neutral. This is enabled per default (controlled by -o parameter), but will only be used if a curve is applied (-t parameter). The properties of this is discussed in the section about DCamProf's neutral tone reproduction operator. You may also want to read the DNG profile implementation notes regarding this before using.
The supplied curve is either one of the built-ins, "linear", "none", "acr" (Adobe Camera Raw's default curve which is a good choice in most circumstances), or a custom curve in a JSON file, or a RawTherapee curve (.rtc) file. The JSON file format can be the same as for the transfer function, but only the "GreenTRC" tag will be used, or "TRC" or "GrayTRC" if those are available. You can also provide a "ProfileToneCurve" from a DNG profile. As usual all other tags are ignored so you can provide a full JSON of a DNG profile (as produced by the dcp2json command).
The RawTherapee .rtc format is supported, but only for "Spline" curves. It's a simple text file format with XY handles for a spline curve in sRGB gamma (both X and Y axes are gamma-scaled), see the data-examples directory for an example. If you wish you can design the curve using RawTherapee and export it from there.
Current tone reproduction operators are
the "neutral" operator, and
"standard" which in the DNG profile case means just embedding the
curve and make no change, and then the raw converter will likely apply
an RGB type of curve. You can also provide the name of a JSON file
that contains custom weights for the neutral tone reproduction
operator. See the ntro_conf.json
file in the data-examples
directory for further details. Normally you should not need to provide
custom weights, but should for example the auto curve analysis lead to
a too large or small chroma scaling factor you can set it manually
using the configuration file.
Some raw converters are meant to be used with colorimetric profiles without any curve, but may still not have any good tone reproduction operator built-in, that is it's very hard to achieve realistic colors as soon as you apply contrast. In that case it may still be worthwhile to apply the tone reproduction in the profile, if the raw converter supports both ways (which is the common case).
The purpose of the feature is to compress the gamut so super-saturated colors fit into a smaller gamut. Typically used to make sure the profile doesn't output colors more saturated than sRGB or AdobeRGB. This is the "gamut mapping" feature, but as it's always used to compress from a larger to a smaller gamut and is much less complex than mapping to a printer's irregular gamut (the usual application for gamut mapping) it's just called "gamut compression".
Although I'm not a personal fan of gamut compression, most bundled profiles have it and few raw converters have good automatic gamut compression so if you shoot lots of saturated colors (such as flowers) and want good tonality without any manual adjustments applying, it can be a good idea to apply some gamut compression in the profile.
Be warned that this is not an easy task, especially since DCamProf lacks a graphical user interface. The process of designing a look means rendering lots of profiles with minor adjustments and comparing until you are satisfied with the result. It requires that you have a good eye for color and know what you want to achieve.
The intention of DCamProf's "look operators" is to make very subtle adjustments, small deviations from the neutral look. That is it's not intended to make "filters" as seen on Instagram and other popular social network services.
Some key concepts:
Available look operators:
As there is no GUI you need to work with trial-and-error. Using a raw converter that quickly and effectively can load new profiles (like RawTherapee) is necessary to keep sanity. To see what colors that will be affected in an image (that is what area the "Blend" section covers) a good alternative is to use "ScaleChroma" with "Value" 0 and then all colors covered by the blend will be monochrome (set "BlendInvert" to true if you want the inverse).
For example if you want to target skin tones you adjust the "Blend" section so only the faces become monochrome, and then you can use this section for various adjustments in the real profile.
Curves are used in blending, and in the "Curves" and "Stretch" operators. There are three type of curves: "Linear", "Spline" and "RoundedStep". The "RoundedStep" is just a step function with S-curve transition, the other two are self-explanatory. Be warned that it's difficult to design a spline in the blind as it easily suffers from overshoots. You can test curves in GNUPlot or design curves in RawTherapee. The RGB curves operator can be mirrored exactly in RawTherapee by selecting ProPhoto working space, and in the operator select "sRGB" gamma, so then you can design the curves operator look there and export the curves, open in a text editor, reformat and put it in your JSON file.
When blending in various look operators there is a risk that you disturb the overall smoothness of the profile, perhaps you're making too strong adjustments with a too narrow blending zone. An effective way to diagnose this is to use the test-profile command and dump and image with processed gradients.
To see how the syntax works and get further documentation, look in the data-examples directory to find a documented example.
When the input hue angle falls in-between two LUT table entries the offset is interpolated. For example if entry A says "add +40 degrees" and entry B says "add -30 degrees" and the input angle falls exactly in-between the average is calculated as "(+40 + -30)/2 = +5 degrees".
If we have a large hue shift say going from +170 to -170, the actual difference between those to neighbors is only 20 degrees and the average would be +/-180, but most DNG pipelines (probably all) don't support hue shift discontinuity and simply calculates this as "(+170 + -170) / 2 = 0". I'd say this is a bug, hue angle discontinuity is a well-known caveat when working with these type of coordinate systems, something that well-design code handles. The discontinuity is just in the math (it must wrap around somewhere), not in the actual hue transition.
Unfortunately Adobe's DNG reference code doesn't handle the wrap, and thus probably all software supporting DNG profiles don't either. Therefore make-dcp will per default abort if it detects a hue shift discontinuity.
Fortunately it's very unlikely that a discontinuity would occur in a normal colorimetric profile. It can quite easily happen when you design a subjective look with look operators though, and the solution is then generally to fade out the operator on the "HSV-Saturation" axis.
The built-in DNG pipeline in DCamProf uses the DNG reference code and will thus cause discontinuity artifacts just like the others. This means that you can see discontinuity artifacts when dumping a test gradient.
Many raw converters sanity-check the profiles to see that the whitepoint in the forward matrix matches 1931_2 D50, and if not they consider the DCP invalid and refuse to load it.
Therefore DCamProf will also do this check and if it detects a different whitepoint it assumes a different observer has been used in profile making and adjusts the matrices and LUT-making with a linear Bradford transform to adapt.
This transform is certainly not perfect when it comes to transform from one observer to another, but as the coordinate shift between observers is so small the error of the transform is probably considerably less than the overall accuracy errors in the profiling process so I think one should not need to worry. Some brief testing I've made confirms this.
As the default observer is 1931_2 this remapping will only take place if you have changed the observer (-o parameter) when making the profile. If you want to compare errors you can run a test-profile on both the native profile and the resulting DCP. The native profile will not need observer remapping. Note that the mapping from the native LUT to the HSM LUT will also generate slight differences from the native profile. Make sure you provide the desired observer in test-profile too, otherwise you will see large errors.
The color matrix is not remapped, as it's not used for the LUT and the difference between observers is way smaller than the error you can expect in a plain matrix conversion it's kept as is.
dcamprof make-dcp -n "Canon EOS 5D mark II" profile.json profile.dcpDual-illuminant profile with the illuminants specified (overrides tags in source profiles):
dcamprof make-dcp -n "Canon EOS 5D mark II" -i StdA -I D65 profile1.json \ profile2.json profile.dcp
dcamprof dcp2json <camera.dcp> [<dcp.json>] dcamprof json2dcp <dcp.json> <camera.dcp>Convert DCP profiles to and from JSON format, useful for making manual edits.
dcamprof make-icc [flags] <profile.json> <output.icc>Converts a profile in DCamProf native format to an ICC profile which can be used directly in various raw converters. Note that ICC profiles that works for one raw converter may not work in the next.
Overview of flags:
-n <camera name>
, actually the ICC "description"
tag, may contain what you like but camera name is a good idea.
-c <copyright>
, the copyright tag string. If
spaces in the string, provide within quotes.
-s <CLUT side division>
, how many divisions the
LUT cube side should be divided in, default is 33.
-p <lablut | xyzlut | matrix>
, profile type (default:
lablut if input has LUT otherwise matrix).
-L
, skip LUT of input profile, the output profile can
still be a LUT if you force it to with the -p parameter.
-W
, let profile correct white balance, usually not
desired except possibly in some specific reproduction setups.
-f <file.tif | tf.json>
, adapt ICC to match
transfer function in provided tiff/json, only required for raw
converters that apply a curve to the raw data before applying the
ICC.
-t <none | acr | custom.json>
,
apply a tone curve to the LUT. For colorimetric accuracy you should
have no curve. To apply a default film-curve, which may yield
a more pleasing look, choose "acr". You can also supply a custom
curve. Note that the tone reproduction operator (-o) will affect how
this curve is used. Default: "none". Curves can be cascaded, that is
you can provide -t
more than once.
-o <neutral | standard | custom.json>
, tone
reproduction operator (default: neutral). Will only be applied
if a non-linear curve is applied (-t parameter).
-g <none | srgb | adobergb>
, gamut compression
presets. Will only be applied if a non-linear curve is applied (-t
parameter) with the neutral tone reproduction operator. You can
configure the gamut compression more precisely in
a tone reproduction operator configuration
file (-o parameter). Default: none (or from the configuration file
if any).
-T
, don't apply tone curve to LUT. Used if the raw
pipeline will apply an RGB curve after the ICC profile is
applied. Note that this is not common, if the raw pipeline applies a
curve separate from the ICC it's normally done before the ICC is
applied.
-r <dir>
, directory to save informational reports and plots
I intend to support the most popular raw converters, I think DCamProf already support most of them but I haven't tested all, so if you find any compatibility issue let me know. I cannot promise I will implement support for every ICC-using raw converter though, if it's too messy I won't support it.
DCamProf supports raw converters which either provide demosaiced linear raw data as input to the ICC (like for example DxO Optics can do), or the same with a curve (like for example Capture One does). If a curve is applied that must be taken into account during the workflow, see the ICC example workflow for further information.
Still, a camera's "as shot" white balance rarely perfectly matches the calibration illuminant, that is a perfectly white patch will not be perfectly white but have a slight tint. DCamProf which knows the the XYZ coordinates for each patch and thus what white should be can correct for this if you'd like.
However, this would mean that when the profile is loaded the white balance will change so a perfect white (rarely exists in the target so it's interpolated) becomes RGB 1,1,1. This might be what you want, but likely not. Probably you want to keep the camera's original white balance and therefore this is the default when DCamProf makes ICC profiles. DCamProf will simply make sure that the profile maps camera RGB 1,1,1 to D50, that is use the native "forward matrix" mapping as is.
Note that since DCamProf normalizes the white balancing when making it's native profile it doesn't matter which white balance the test image had, meaning that you can convert the same native profile to both a DCP and an ICC profile, even when it was made from non-white-balanced data (like DCP requires).
Are there cases when you do want the ICC profile to correct the white balance? Yes, for example in a fixed light reproduction setup when you want to use a white balance preset on the camera (easy to remember and recall) but still get as correct white balance as possible in the final image, then the ICC profile should correct it. To do so supply the -W flag when making the ICC. For this to work the native profile must have been made from a white-balanced test image though (using the camera's preset of interest).
By specifying the type you can even make a LUT profile even if the input does not have a LUT, which may be useful for testing in some cases.
An ICC LUT is always 3D, a simple table with RGB triplets in and corresponding XYZ or Lab triplets out. Ideally you would have a table entry for all possible RGB combinations which would be 65535^3 for 16 bit data, but that would fill your hard-disk with just the ICC profile so it's not a good idea. Instead very small ranges are used (33 is default) and the inbetweeners are interpolated.
DCamProf generates the ICC 3D LUT by sampling native LUT (and possibly tone reproduction operator), and applies an input curve to get better perceptual spacing of the LUT cube divisions. ICC LUT resolution can at times be a problem, if you get problems matching some patches you can try increasing the cube divisions from the default 33, be warned though that the size of the ICC file will grow very fast. A reasonable test value is 128 which will give you about a 12 megabyte ICC profile, and then reduce from there towards the default 33.
DCamProf can make an RGB to XYZ or an RGB to Lab LUT, the latter is the default. Currently the XYZ LUT uses the forward matrix directly which means that extreme value handling is not as good as the Lab LUT, so I recommend staying at the default Lab LUT.
Many ICC raw converters apply a curve on the side though (like Capture One), and in that case you should employ a linear curve during profiling and use that when using the finished profile, as the LUT applies the curve.
If you want to apply a subjective look you can do so, as documented in the subjective look design section. A difference from DNG profiles is that ICC profiles will allow you to change the color of neutrals.
You can also enable gamut compression.
-r <report_dir>
flag to
get report files which include ICC plot
files. As ICC LUTs are 3D they are a bit cumbersome to visualize. You can
plot all points in the 3D LUT "cube" by plotting icc-lut.dat
,
but it may be better to plot a slice at a time using
the icc-lutXX.dat
files. The main thing to look for is if the
LUT seems dense enough to replicate the stretching that is in the
native 2.5D LUT. You don't want to have it overkill dense either as
that will make the ICC file larger than needed, and LUT ICCs are
always a bit large due to that they are always 3D.
splot \ 'icc-lut.dat' w d lc "beige", \ 'gmt-locus.dat' w l lw 4 lc rgb var, \ 'gmt-adobergb.dat' w l lc "red", \ 'gmt-pointer.dat' w l lw 2 lc rgb var, \ 'target-icc-lutve.dat' w vec lw 2 lc "black",\ 'targetd50-xyz.dat' pt 5 ps 2 lc rgb varThe example shows the default LUT with 33x33x33 points, it still becomes very dense in a 3D plot. The sides of the "gamut" are quite sharp and the shape is boxy, this is because the LUT reaches the full range of the LUT and clips (this is outside the real color range though, so don't worry).
splot \ 'icc-lut10.dat' w d lc "beige", \ 'gmt-locus.dat' w l lw 4 lc rgb var, \ 'gmt-adobergb.dat' w l lc "red", \ 'gmt-pointer.dat' w l lw 2 lc rgb var, \ 'target-icc-lutve.dat' w vec lw 2 lc "black",\ 'targetd50-xyz.dat' pt 5 ps 2 lc rgb varThere are 20 slices indexed 00 to 19, here we plot index 10 which means 0.5 to 0.55 in the native LUT lightness range (which is Lab lightness scaled to 0.0 - 1.0 range).
We see here that the profile is less accurate on darker colors (longer error vectors), while spot on on the brighter. The beige crosses show the LUT points in the slice. They are here in close-by pairs as the slice fits two levels (look from the side to see), so for the actual "2D" density think of the nearby pairs as one point.
dcamprof icc2json <camera.icc> [<icc.json>] dcamprof json2icc <icc.json> <camera.icc>Convert ICC profiles to and from JSON format.
ICC is a large standard and supports many types of devices in addition
to cameras, such as printers, scanners and monitors. DCamProf's ICC
parsing is only focused on ICC version 2 camera profiles, and will
ignore any irrelevant tags and refuse to parse ICC profiles that are
not camera profiles. That is it's intended to look at and edit camera
profiles, nothing else. This means that icc2json
does not
work well as a general ICC dis-assembler. If you really need to see all
tags in an ICC Profile you can for example use
Argyll's iccdump
tool.
dcamprof tiff-tf [flags] <target.tif> [<transfer-function.json>]Extract transfer function (TIFFTAG_TRANSFERFUNCTION) from a TIFF file and write it to a JSON file. The transfer function is a linearization curve, that is if the data has been made non-linear of by a tone curve the transfer function will be the inverse of the tone curve.
The extracted transfer function can then be used in other relevant commands such as make-icc to linearize data. However make-icc/make-dcp etc can take the TIFF file directly so extracting it first is generally only for informational purpose.
You can however also calculate a tone curve using this command (as the difference between two transfer functions), which cannot be done with any of the other commands.
-R
, skip reconstruction. The transfer functions are
defined using integers and often there are several entries in a
row with the same number due to the rounding. Per default DCamProf
will reconstruct those values with a robust linear
interpolation. If you don't want that to happen you provide enable
this flag.
-f <linear.tif | linear.json>
, reference TIFF /
JSON with the transfer function corresponding to linear
response. This is then used to convert the provided tiff to a
tone-curve in linear space rather than a transfer function.
dcamprof tiff-tf -f linear.tif curve.tif tone-curve.jsonThe output will then contain a tone curve in linear space calculated by applying the transfer function from "linear.tif" to the inverse of "curve.tif". This tone curve can then be provided to make-icc or make-dcp with the
-t
parameter.
dcamprof txt2ti3 <input.txt> <output.ti3>Import spectral data from a text file, further described in the make-target section.
dcamprof [flags] make-testchart <output.ti1>Generate an Argyll
.ti1
file (like Argyll's
own targen
) that can then be used with
Argyll's printtarg
command to make a test chart that can be
printed.
Overview of flags:
-p <patch count>
, choose number of patches to
generate, default is 100.
-w <percentage white patches>
, specify the
percentage of white patches. The target will be speckled with white
patches which then can be used as anchors for flatfield
correction. Default: 20%.
-b <black patch count>
, black patches doesn't
really contribute to profiling, but is good to have a few for sanity
checking contrast and exposure. The default count is 5 which will be
evenly spread out over the target.
-g <gray steps>
, if you want a linearization step
wedge specify here how many in-between gray levels there should
be. The number of gray patches on each level is the same as the
black count.
-l <layout row count>
, specify the intended row
count of the target. Specifying layout is required if you want an
optimal white patch distribution.
-d <layout row relative height>,<column relative
width>
, relative width and height of patches, you can specify
it in any unit you like as it's only relative. Default: 1,1 (square patches).
-O
, specify this flag if the chart layout has even
columns offset a half patch. Argyll's printtarg makes Colormunki
style targets this way.
-r <dir>
, directory to save informational reports
and plots.
The patch placement in terms of perceptual distance will not be perfect as the command is unaware of the printer's profile, but as the coverage is intended to be dense it doesn't matter that much. If it becomes popular to make own targets I may further develop this command to support printer profiles and more.
Today's inkjet printers typically have more colorants than older models, which means that the spectra can be a bit more varied. However the spectral variation will still suffer compared to commercial test targets made with special printing techniques. Your mileage may vary.
The test chart generator intention is to fill the gamut so it will need quite many patches to not miss out any corner. 50 patches is probably more than enough, but if you're printing an A4 sheet you could just fill it even if it will be a bit overkill. You can increase the white patch percentage to save ink.
With the -b and -g parameters you can add step wedges for linearization. This might be an advantage for targets that will be shot in situations where glare can be an issue.
dcamprof testchart-ff [flags] <input.ti1 | layout.json> \ <input.ti3> [<input2.ti3>] <output.ti3>...or
dcamprof testchart-ff <input.tif> <flatfield.tif> <output.tif>Either flatfield correct .ti3 data or a linear .tif file. If you're correcting a .ti3 file it must be a target speckled with white patches and the layout need to be specified via a .ti1 file and the layout flags, or a layout JSON format (documented example in the data-examples directory). If you are correcting a .tif file the input files must be 16 bit linear gamma TIFF files.
It's also possible to model glare, this requires a neutral step wedge in the file, or even better neutral patches (black, white and middle gray) spread out over the whole surface. Overview of flags:
-l
, -d
, and -O
layout specification flags working the same as for
the make-testchart command.
-L
, enable glare matching.
-r <dir>
, directory to save informational reports
and plots.
At first glance the target may look well-lit and without issues, and indeed the white patches along the border are all equally bright, indicating perfectly even light (no need for flat-field correction here!). However look at the black patches, the ones along the right border are considerably lighter than the ones on the left. This is not uneven light, the neighboring white patches are the same brightness, the problem is instead glare. The target thus get lower contrast on the right side where there is more glare than on the left.
The animated images shows what happens if you make a profile ignoring the glare. Look at the dark red-purple patches in the top right corner. They become much darker with the uncorrected profile. The reason is that the make-profile gets much brighter camera raw samples than it should (affected by glare) and thus makes a profile that darkens them heavily to compensate.
As glare lowers contrast affecting dark colors the most, the resulting profile will thus compensate and the result will be opposite, too much contrast and too high saturation.
The left side has much less glare and thus the colors change less between the two profiles. However if hue is shared with a patch on the heavily affected side there is still a strong effect which can be noted in the pink patch in the CC24 section of the target. Note that the animated GIF image is limited to 256 colors so the more subtle differences in saturation etc cannot be seen.
The ColorChecker SG target is interesting as it's one of the few commercial targets that has white/black/gray calibration patches along the border of the target. DCamProf makes use of this and thus both flat-field corrects and makes a locally varying glare matching. This way the right side patches have been strongly corrected while limiting the effect on the left side.
While a good result is had with this shot, I strongly recommend against relying on glare matching. Instead make a proper setup which has less glare than shown in this example. It's much more important to minimize glare than to have even light, as flat-field correction can even out light precisely without adverse effects, while glare matching is by nature an imprecise model.
If you have been really careful when shooting your target to have uniform light the difference of applying flat-field correction will be negligible so it's certainly not mandatory. If you shoot a large target indoors and have only one light it's however most likely that you need to flatfield correct.
If your target is speckled with white patches you don't need to shoot an extra flatfield shot, correction can be made directly on the .ti3 data. When the target is photographed we know that if the lighting is perfect all white patches should give the same RGB values. Light is never 100% uniform though so the white patches will vary. Based on the positions of those white patches and the variations thin plate spline correction maps are created to scale all patch values to match uniform light.
The indexes of white, black and gray patches are found out from the provided .ti1 file. If you have used the make-testchart command you have already such a file, if not you're better off making a target layout JSON file, look in the data examples directory to find a documented example. For flat-field correction you only need to point out the white patches.
Most commercial targets are not speckled with white patches though unfortunately, and then you need to pre-process the TIFF file before you feed it to Argyll's scanin. First shoot the target, then with the exact same lighting place a equally large or larger white card in the exact same position as the target, and shoot it from the exact same camera position. Then make the exact same crop/rotation of both files and export to linear 16 bit TIFF. The image must be cropped enough so that only the white section of the white card is visible, if any surroundings or edges of the card is visible the result will not be good.
Feed those TIFF files to the testchart-ff command and you will get a new flat-field corrected output file which you then can feed to Argyll's scanin.
Another alternative is to print a chart with only white patches (ie only a grid) that exactly matches the target you have, and swap in that in a second shot (light and camera setup must be stable of course). You then run testchart-ff with this extra .ti3 file, so you have first the layout .ti1 file (showing only whites in this case), the white target .ti3, and then your real target .ti3 and finally the output .ti3 file. This is a bit cumbersome way to make flatfield, in this case it would probably be simpler to shoot a gray or white card instead and pre-process the TIFF file.
There are specific white card products to buy, but these are quite expensive. Instead you can for example use an unprinted high quality photo paper (without see through), I recommend a smooth matte OBA-free paper, make sure it lays perfectly flat just like the target. It does not matter if the card is slightly off-white, flat-field correction just corrects differences from the global average so the color of the card does not matter (if the card is colored, the global average changes too so it cancels out).
That is instead of removing glare from the raw samples, we add glare to the reference data. As DCamProf knows the response of the observer (unlike the camera) it can apply certain robustness features to the glare model. The problem with glare modeling is that unlike flatfield correction it cannot be very precise. There are too many unknown factors, so DCamProf must rely on very coarse models. With more advanced models there's a large risk that you actually make things worse than better.
In DCamProf's glare matching robustness is main priority, that is don't make it worse than it was from the beginning. For example the glare matching will not alter hue, only lightness and chroma.
You can enable glare matching with the -L
flag. It only works
on .ti3 files, so if you have a TIFF you can flatfield it first, then
scan it and then glare match the .ti3 file by running this command
again. A flatfield pass is always run first (if possible), then
linearization is applied.
I do recommend to do everything you can to minimize glare though so glare matching will not be required. While it's perfectly ok to rely on flatfield correction, as it can accurately even out light, it's not a good idea to rely on glare matching.
If you run with a report directory (-r
parameter) you will
find glare-match.tif
there which shows how the reference
patches were adjusted (that is lightened) to match the camera glare.
dcamprof average-targets <input1.ti1> [<input2.ti3> ...] <output.ti3>If you have problems with too much noise in the darkest patches in your test target photos, you can make multiple shots, convert all to .ti3 files and then average them using this command. Averaging shots is an alternative to classic HDR merging and has the advantage that all shots are fully usable and thus scannable by Argyll's
scanin
command.
Of course you can do averaging/merging of images in other software too
and make a new image which you then feed to Argyll's scanin
,
however you must then be absolutely sure that the software produce
100% linear results.
dcamprof match-spectra [flags] <reference.ti3> <match.ti3> <output-match.ti3> \ [<output-ref.ti3>]Find the spectra in
match.ti3
that best matches the spectra
in reference.ti3
, either as seen by an observer or by camera
SSFs.
Overview of flags:
-o <observer>
, observer for DE comparison,
default 1931_2.
-i <test illuminant>
, the illuminant the
comparison is run under, default D50.
-c <ssf.json>
, camera SSFs, if provided these
will be used instead of the observer for patch spectrum comparison,
and then Euclidean distance is used as error value instead of
CIEDE2000.
-S
, scale spectra (that is adapt lightness) in output
to better match the reference spectra.
-N
, normalize patches before comparison, that is
keep original lightness instead of equalizing them before comparison.
-U
, don't allow repeats of the same spectrum in the
output. That is if the best match for a given patch is also the best
for another it's written to the output each time.
-E
, consider all spectra as emissive. DCamProf supports
a tag in the ti3 files that says if the spectrum is emissive or
not. This flag causes the tag to be ignored, and all spectra is
considered emissive, that is it will not be integrated with the
test illuminant.
-e <max DE>
, maximum acceptable DE to consider it
to be an acceptable match, default is infinite that is the best
regardless of error is included.
-r <dir>
, directory to save informational reports
and plots.
This command is typically not used in any profiling workflow, but is instead used for informational purposes. You can for example test how well the "skin-tone patches" of your commercial target matches real skin-tones from a spectral database.
As DCamProf's camera profiles are 2.5D it often makes sense to scale
lightness to match both in comparison (-N) and in output (-S). If you
specify one output it will contain spectra from the match.ti3
that matches, and if you specify two the second output will contain
the patches from reference.ti3
for which an acceptable match
was found. Per default there's no error limit and non-unique matches
are allowed and then the second output will be a copy
of reference.ti3
If a report directory is given (-r), spectra and XYZ coordinate plots for inputs and outputs are written there.
dcamprof si-render [flags] <spectral image> <output.tif>Render a normal RGB TIFF from a spectral image, specifying illuminant and observer or camera SSF.
Overview of flags:
-i <illuminant>
, the illuminant to light the
spectral image with, default D50.
-o <observer>
, observer, default 1931_2.
-c <ssf.json>
, camera SSFs, if provided these
will be used instead of the observer.
-g <gamma>
, gamma in output, default 1.0. Note
that 1.8 is required if later processed by test-profile.
-W
, apply white balance.
-P
, enable ProPhotoRGB output.
-a <bradford | cat02>
, choose CAT (output space
is D50 in this case).
The spectral image format must either be the SPB format or be a directory with normal monochrome TIFF files with spectral band (in nanometers) in the filenames. An example image with this format is the METACOW test image from Munsell Color Science Laboratory.
For the SPB format description and links to example files you can go to the www.multispectral.org web site.
Spectral images can become very large and DCamProf will read it all into memory, so make sure you have enough RAM.
While you can use this to just test differences between observers or CATs, the typical use case in camera profiling is when you have camera SSFs and want to test how camera profiles react under different light. You then render "virtual raws" with your desired illuminant and camera SSF using this command, and then you process that through the profile by using the test-profile command:
dcamprof si-render -c 5dmk2-ssf.json -W -g 1.8 -i D65 input.spb test.tif dcamprof test-profile -c 5dmk2-ssf.json -i D65 test.tif 5dmk2.dcp output.tif
-r <report_dir>
flag
enabled it will write data files for plotting and report text
files. The files are suitable to plot
with gnuplot, but you can use
any other plotting software if you like as it's just text files with
the numbers in columns.
cm-patch-errors.txt
, color matrix patch matching errors
fm-patch-errors.txt
, forward matrix patch matching errors
patch-errors.txt
, patch matching with full LUT
correction (if any)
A1 RGB 0.076 0.095 0.040 XYZref 0.130 0.113 0.057 XYZcam 0.129 0.112 0.054 \ sRGB #7C5547 #7C5445 DE 0.60 DE LCh -0.23 +0.46 0.31 (dark brown)First there's the patch name (A1 in this example) then camera raw RGB values (0.0 - 1.0 range), then CIE XYZ reference values (0.0 - 1.0 range), and then what XYZ values the profile transform came up with, and then sRGB values of reference and profile (note that these will only be accurate if the color is within the sRGB gamut), and then CIEDE2000 values for color difference between reference and converted value, related to the test illuminant.
The first delta E value is the total with 1,1,1 k weights, the following three is considering lightness (L) chroma (=saturation, C) and hue (h) separately. The lightness and chroma have a sign so you can see if the color is lighter (+) or darker (-) than it should be, and if it's more saturated (+) or less saturated (-) than it should be. In the above example we see that most part of the color difference sits in chroma (0.46 delta E), and it's a tiny bit too dark and too saturated.
Finally there's a text name of the color. This text name is highly approximate and may not really be that correct, but it roughly points out the type of color in lightness (light, dark), chroma (grayish, strong, vivid etc) and hue. Look at the corresponding image files if you want the reports with actual colored squares to represent the patches.
cm-patch-errors.tif
, fm-patch-errors.tif
, patch-errors.tif
,
same as the text files patch matching
reports, but showing the actual patches as colored squares.
gradient-ref.tif
, gradient.tif
, generated
gradient images for diagnosing profile
smoothness.
Most files have u'v' chromaticity coordinates, and if there's lightness there's CIE Luv / CIE Lab lightness divided by 100. The division by 100 is there to make it about the same scale as u'v'. This is the same 3D space as the DCamProf LUT operates in and is roughly "perceptually uniform", that is moving a certain distance in the diagram makes up a certain color difference. However as the space is linear and lightness is normalized it's not as uniform it could be, especially towards the line of purples which in reality goes towards black and thus hard to differ for the eye.
Here's a list of data files you can find in the report directory after a run:
cmf-x.dat
, cmf-y.dat
, cmf-z.dat
,
the observer's color matching functions.
ssf-r.dat
, ssf-g.dat
, ssf-b.dat
,
the camera's spectral sensitivity functions.
illuminant.dat
emissive spectrum for the illuminant.
illuminant-d50.dat
emissive spectrum for the standard
illuminant D50.
gmt-srgb.dat
, sRGB gamut
gmt-adobergb.dat
, Adobe RGB gamut
gmt-prophoto.dat
, ProPhoto gamut
gmt-pointer.dat
, Pointer's gamut
gmt-locus.dat
, spectral locus for the chosen
observer
gmt-cm.dat
, gmt-cm2.dat
, ColorMatrix
gamut. ColorMatrix2 is for DNG profiles only.
gmt-fm.dat
, gmt-fm2.dat
, ForwardMatrix
gamut. ForwardMatrix2 is for DNG profiles only.
gmt-lm.dat
, LUTMatrix gamut
gmt-prof.dat
, profile maximum gamut, that is the
maximum area the profile will cover for all possible
inputs. The profile is coarsely sampled so it may miss some
corners.
gmt-prof-look.dat
, profile maximum gamut, including
LookTable (DNG profiles only).
target-xyz.dat
, XYZ reference values for the
patches, usually for the calibration illuminant
target-spectra.dat
, reflectance spectra for the patches
target-xyz-<classname>.dat
, target-spectra-<classname>.dat
,
same as above split per target class name.
targetd50-*
, D50 versions of above. Note that
spectra are the same regardless of illuminant as it's the
reflectance spectra.
live-patches.dat
XYZ reference values for the
chosen illuminant.
live-spectra.dat
reflectance spectra for the patches.
nve-lut.dat
, native LUT stretching in u'v'
difference (addition), plus the L multiplier shown as a 1/10th
of the difference from 1.0. The reason for the strange L scale
is that the LUT stretching on the L scale should be fairly
perceptually equal to the chromaticity stretch. That is any bend
on the surface should have equal perceptual effect regardless of
axis.
nve-lutd.dat
, same as nve-lut.dat
but the
grid is sampled with higher density, useful for zoomed in or
high resolution plots.
nve-ref.dat
, a plain grid showing a LUT with no
correction factors, can be used to plot a reference to compare.
nve-lutv.dat
, vectors that show the difference
from nve-ref.dat
to nve-lut.dat
hsm-lut.dat
, hsm-lutv.dat
, hsm-ref.dat
,
same as the nve-*
files, but for the DCP HueSatMap LUT.
lkt-lut.dat
, lkt-lutv.dat
, lkt-ref.dat
,
same as the nve-*
files, but for the DCP LookTable LUT.
lkt-lutXX.dat
, hsm-lutXX.dat
, replace XX
with 00 to value divisions-1, shows each value slice from a DCP
3D LUT. Will not be produced for 2.5D LUTs.
icc-lut.dat
, all points in the ICC 3D LUT plotted
in the same space as nve-lut-dat
.
icc-lutXX.dat
, replace XX with 00 to 19, shows
slices of the ICC 3D LUT.
target-nve-lut.dat
, the target patches' XYZ positions
after native LUT correction.
target-nve-lutvm.dat
, vectors showing the
difference between matrix-only correction and LUT correction.
target-nve-lutve.dat
, vectors showing the
difference between target reference values
target-nve-lutve2.dat
, same as *lutve.dat
,
but the length of the vector is CIEDE2000, divided by 100 to fit
in the u'v' scale.
target-nve-lutve3.dat
, same
as *lutve2.dat
, but colors normalized to lightest
possible value first, that is what the error would be if the
color was light, normally increases error for dark colors.
(targetd50-xyz.dat
) and the profile's final values
after LUT, that is the error vectors. For a perfect match these
are all zero length.
target-hsm-lut.dat
, target-hsm-lutvm.dat
, target-hsm-lutve*.dat
,
same as the target-nve-*
files, but for the DCP LUT.
target-icc-lut.dat
, target-icc-lutve*.dat
,
same as the target-nve-*
files, but for the ICC
LUT. Note that the *-lutvm.dat
doesn't exist for ICC as
there is usually no XYZ matrix.
target-mtx.dat
, target-mtxve*.dat
, the
target patches' XYZ positions after matrix-only correction, plus
the corresponding error vectors.
ssf-csep.dat
, camera color separation performance,
documented separately.
tf-r.dat
, tf-g.dat
, tf-b.dat
,
transfer functions for linearizing RGB values.
tc.dat
, tc-srgb.dat
, tone curve in linear
and sRGB gamma encoding (both axes).
target-ref*
, target-match*
, target*
,
target-refm*
, target spectra and XYZ plots written by
the match-spectra command.
glare-curves.dat
, glare matching curves from the
testchart-ff command (only when glare matching is enabled).
glare-match.tif
, patch difference chart before
after glare matching.
gnuplot -background gray
. All examples here are
adapted for a gray background.
In gnuplot you do 2D plots with the plot
command, and 3D
plots with splot
. It's often useful to view a 3D plot in 2D
though, and thanks to gnuplot's isometric perspective viewing a 3D plot
straight from above makes it perfectly 2D.
You can rotate a 3D plot using the mouse, and you can zoom
in by right-clicking and drawing a zoom-in-box. Type reset
and replot
to return to the original view. It's not a quick
thing to master gnuplot, but with the help of the example scripts here
you should be able to get around and do the tasks necessary for
visualizing DCamProf data.
You can label the axes etc, but I usually make it simple and just
remove all labels with unset key
.
plot \ 'cmf-x.dat' w l lc "pink", \ 'cmf-y.dat' w l lc "greenyellow", \ 'cmf-z.dat' w l lc "cyan", \ 'ssf-r.dat' w l lc "red", \ 'ssf-g.dat' w l lc "green", \ 'ssf-b.dat' w l lc "blue"
plot 'target-spectra.dat' w l lc rgb varThe example shows cc24
set grid splot \ 'gmt-locus.dat' w l lw 4 lc rgb var, \ 'gmt-adobergb.dat' w l lc "red", \ 'gmt-pointer.dat' w l lw 2 lc rgb var,\ 'target-xyz.dat' pt 5 lc rgb varNot shown in the picture, but you can also get text labels beside each patch by adding:
'target-xyz.dat' using 1:2:3:5 with labels offset 2
make-profile
or test-profile
run with a target with relative few patches (such as a cc24):
splot \ 'nve-lut.dat' w l lc "beige", \ 'gmt-locus.dat' w l lw 4 lc rgb var, \ 'gmt-adobergb.dat' w l lc "red", \ 'gmt-pointer.dat' w l lw 2 lc rgb var,\ 'target-nve-lutvm.dat' w vec lw 2 \ lc "black", \ 'targetd50-xyz.dat' pt 5 ps 2 \ lc rgb varThe image shows a zoomed in section, viewed directly from above, so we see a 2D chromaticity diagram with the LUT stretching in the chromaticity dimension. The black LUT vectors are only a little visible as the matrix alone makes a fair match.
test-profile
run with a dense target, such as
a locus grid:
splot \ 'nve-lut.dat' w l lc "beige", \ 'gmt-locus.dat' w l lw 4 lc rgb var, \ 'gmt-adobergb.dat' w l lc "red", \ 'gmt-prophoto.dat' w l lc "blue", \ 'gmt-pointer.dat' w l lw 2 lc rgb var,\ 'target-nve-lutve.dat' w vec lc "black"Here we only plot the error vectors, the actual color (reference XYZ) is at the start of the arrow and where it ends up after profiling is at the end of the arrow. For a perfect profile on a perfect camera the vector length should thus be zero over the whole field. As we can see in the example to the right errors typically grow large towards the locus, the matrix even moves points outside the human gamut.
test-profile
run with a DCP profile:
splot \ 'hsm-lutv.dat' w vec lc "beige", \ 'gmt-locus.dat' w l lw 4 lc rgb var, \ 'gmt-adobergb.dat' w l lc "red", \ 'gmt-prophoto.dat' w l lc "blue", \ 'gmt-pointer.dat' w l lw 2 lc rgb var,\ 'targetd50-xyz.dat' pt 5 ps 1.2 \ lc rgb varHere we plot the DCP HSM LUT as vectors, it can't be plotted like a grid like the native LUT. The vectors show each table position at vector start and their shift in chromaticity and lightness at vector end. Note that a DCP HSM LUT actually changes values through multiplication in linear Prophoto RGB HSV space, that's why the LUT looks like a star fitted in the ProPhoto triangle with high density at the white-point. The lightness axis has been transformed to match the same scale as the native LUT so the LUTs can be compared directly.
Be careful to watch gnuplot's auto-scaling of axes. The lightness axis in a LUT often gets greatly exaggerated or compressed due to it's not plot at the same scale as chromaticity. Use the set view equal command to turn on/off equal scaling (xyz = equal scaling on all axes, xy = default meaning chromaticity equal and lightness scaled to fit).
set view equal xyz set view equal xyWith equal scale on the L axis a LUT typically looks very flat as L adjustments are generally minor.
More example scripts are found throughout the documentation.
There are reference standard sets such as the ISO TR 16066, but those are not free and cannot be freely redistributed so I can't include that in DCamProf.
If you know of any database you think is useful for inclusion please let me know.
The other aspect is camera SSFs. It's quite complicated and/or costly to measure camera SSFs so most users will not be able to do that and thus have to rely on public sources. If you can provide camera SSFs or have links to sources I have missed please let me know.
dcamprof
txt2ti3 ...
I also would like to thank all early adopters for testing the software.
Thanks to Mike Hutt for the Nelder-Mead simplex implementation which is used in DCamProf for solving various multi-variable complex optimization problems. I also want to thank Jarno Elonen for publishing a thin plate spline implementation which served as base for the DCamProf TPS used for getting a smooth LUT.
The copyright for the TPS source is required to be repeated in the documentation, so here it is:
Copyright (C) 2003, 2004 by Jarno Elonen Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The authors make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.