Rawtoaces - Calling All “developer-types”

Calling All “developer-types” …
and anyone not afraid of a little experimentation.

A while back I teased that we were working on a tool to help those wanting to convert digital camera RAW files into ACES. Well today we’re unveiling that tool (in Beta) to the ACEScentral community.

The tool is based on libraw and implements the IDT generation methods we published in P-2013-001: Recommended Procedures for the Creation and Use of Digital Camera System Input Device Transforms (IDTs). We call it rawtoaces and it can be found on our github page.

Right now, the tools isn’t for the faint-of-heart. It requires you’re comfortable using github, compiling software, and using the command line, but if you’re ok with that we’d love to get your feedback. It’s also worth mentioning this software is under very active development. There’s still bugs to squish and improvements to make, so it’s probably best not to use it as the corner stone of your upcoming mission critical movie release!

The software uses libraw to open a wide range of RAW file formats. It then uses some metadata in the files to try to figure out the source used to photograph the scene. If the spectral sensitivities of the camera are known they are used to derive an IDT based on those spectral sensitivities and the “adopted” scene source. That IDT is then applied to the image and the results are placed in an SMPTE 2065-4 compliant ACES container (exr) file.

If spectral sensitivities of the file aren’t available, the software uses metadata in the file to do our best to convert the files to ACES, but your mileage may vary here. Also, it has tons of options to override default behaviors, so it’s pretty flexible. Again, not for those green circle novice types but if you enjoy the double black diamonds, we’d love your thoughts.

We hope you enjoy rawtoaces and this process will be a great model of community participation and open ACES development. In that vein, pull requests are gladly accepted for community review!

5 Likes

Wow, this is great! I am excited to start playing around with this. I saw in the data/camera folder there are .json files for the spectral sensitivity data of different cameras. Is the structure of these files unique to rawtoaces?

Regarding the data, I found this site from a researcher who measured the sensitivity of a variety of professional and consumer cameras. However, his experiment measured from 400nm to 720nm, while I see that your data goes from 380nm to 780nm. Does rawtoaces require the full range of data or can it work with less information?

@agentirons Thanks … the JSON structure is derived from the IES spec for a file format for light source spectral data, but the spec sens file format is new to rawtoaces. One of this things on the list to do is to more fully document the format (noted here). Thanks for pointing us to Dengyu Liu’s database. We might be able to extrapolate the ends.

Looks like the National Physical Laboratory (UK) also has full spectral data on the Nikon D5100 and the Sigma SDMerill - https://spectralestimation.wordpress.com/data/

If I discover more sources like this with proper datasets, would you prefer pull requests on github to add new json files or would you like to handle creating them yourself?

@agentirons Thanks for the heads up! Pull requests are always welcome, but we can easily do it if you just point us to the datasets.

Hey there,

I just downloaded “github.com/ampas/rawtoaces” and tried to compile, but it looks like I have some unresolved symbols?

I did the mandatory…

$ mkdir build && cd build
$ cmake …
$ make
$ sudo make install <didn’t come this far>


cmake said this:

– The C compiler identification is unknown
– The CXX compiler identification is unknown
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Found IlmBase, version 1.0.1
– Found AcesContainer, version 1.0.1
– Found LibRaw, version 0.15.4
– Found installed version of Eigen:
– Found required Ceres dependency: Eigen version 3.2.0 in /usr/include/eigen3
– Found required Ceres dependency: glog
– Looking for include file pthread.h
– Looking for include file pthread.h - found
– Looking for pthread_create
– Looking for pthread_create - not found
– Looking for pthread_create in pthreads
– Looking for pthread_create in pthreads - not found
– Looking for pthread_create in pthread
– Looking for pthread_create in pthread - found
– Performing Test GFLAGS_IN_GOOGLE_NAMESPACE
– Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Success
– Found required Ceres dependency: gflags
– Found Ceres version: 1.13.0 installed in: /usr/local with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, CXSparse, SchurSpecializations, OpenMP]
– Found Boost_FOUND, version 105400
– Configuring done
– Generating done
– Build files have been written to: /mnt/c/dev/rawtoaces-master [Downloaded]/build


Compiling under Ubuntu (inside a Win10 installation). The exact output from “make” is:

Scanning dependencies of target rawtoacesIDT
[ 33%] Building CXX object lib/CMakeFiles/rawtoacesIDT.dir/rta.cpp.o
Linking CXX shared library librawtoacesIDT.so
/usr/bin/ld: CMakeFiles/rawtoacesIDT.dir/rta.cpp.o: Die Umlagerung von
CMakeFiles/rawtoacesIDT.dir/rta.cpp.o: error adding symbols: Ung��ltiger Wert
collect2: error: ld returned 1 exit status
make[2]: *** [lib/librawtoacesIDT.so] Fehler 1
make[1]: *** [lib/CMakeFiles/rawtoacesIDT.dir/all] Fehler 2
make: *** [all] Fehler 2

(yes: the “��” are coming from my console)

What am I doing wrong?

@tim.edelmann Humm … that’s an interesting one. Not sure were the German is coming from either. Does that have something to do with your install? We’ll have a look and see if we can’t this build bug squashed.

I’ve tried using Dengyu Liu’s data, extrapolating the missing wavelengths but maintained the 10nm increments. I get an error:

Please double check the Camera Sensitivity data (e.g. the increment should be uniform from 380nm to 780nm).

Must measurements be 5nm for this to work?` Is it ok to interpolate?

Second question:

This (I think) is the Blackmagic Cinema Camera’s sensor and contains monochromatic and bayer CFA Spectral Sensitivity data between 400nm to 1100nm (10nm increments).

The green channel peaks at 0.38 (540nm) but I’ve noticed RAWTOACES JSON data is normalized to 1.0 around this wavelength.

Must the data always be normalized?

Fortunately I managed to get around my ‘compliling’-Problem. It looks like your first idea was right and it built perfect after setting up a Debian-Virtual-Box. Must have had something to do with Win10, I’d guess… Now its working and we start trying things out.

Thank you for the quick response!

Hello again,

after having successfully compiled the beautiful rawtoaces tool, we are struggling with one of the parameters. We are trying to generate the same results we can create via Affinity Photo.

Since the other options seem to work and the tool itself produces images, which are pretty close to what we need, we aren’t sure if the problem is on our side or on rawtoaces’ side…

When we try to:

$ rawtoaces -H 1 ourfile.CR2

we get the error message:

Error: Non-numeric argument to “-H”

According to --help, it is the correct syntax:
-H [0-9] Highlight mode (0=clip, 1=unclip, etc.)

Is there something we missed?

It has just been fixed. We will merge this change soon onto “ampas/master” branch.

Thanks for testing “rawtoaces”

1 Like

Hi Miaoqi Zhu,

thank you very much for beeing THAT FAST! These reaction-times are a pleasure to work with.

We implemented the quick-fix into our local copy of the master and it worked instantly!

Good day everybody,

[Little Disclaimer: plaese correct me, if I’m wrong here. ]

after the fix miaoqi implemented yesterday, we played around with various options, to find a way of creating images, that look as close as possible like the results Affinity Photo does for us. While trying, we noticed, that the parameter “-c” is not working and returned always with “Error: Non-numeric argument to ‘-c’”.

We looked it up in usage.h and found the lines 249 and 250 which -if I got it right- seem to declare which parameter can take which amount of parameter-values (i.e. ‘-H’ takes one parameter-value). If thats correct, these lines show, that parameters “H”, “M” and “G” should take one parameter-value and “c” should get four?

usage.h

line: 249 if (( cp = strchr ( sp = (char*)“HMGcnbksStqmBC”, opt )) != 0 )
line: 250 for (int i=0; i < “111411111142”[cp-sp]-‘0’; i++)

For a test, we changed these lines to:

our new usage.h

line: 249 if (( cp = strchr ( sp = (char*)“HcnbksStqmBC”, opt )) != 0 )
line: 250 for (int i=0; i < “111111111142”[cp-sp]-‘0’; i++)

As you can see, we removed the parameters “M” and “G”, since these are either not listed by “rawtoaces --help” or should take no parameter-values. And we switched the “4” in position four to “1”, since every paremeter takes exactly one parameter-value, excluding “B” and “C” which take four and two parameter-values.

Having these changes in place, we were able to use the “-c” parameter.

Again: As I’m not the creator of this code, I might have missunderstood something, don’t hesitate to correct me here

Thanks Tim! we just saw it. Yes, I was busy fixing other bugs so I did not notice it.

You are right, [cp-sp] will return the index pointer to “111111111142”, then minus ‘0’, then we get the number of parameter inputs for the flag.

I will correct it now.

Thanks again and have a great weekend!

1 Like

Hi folks!

I have cloned the rawtoaces Git repository and followed the compilation instructions, including the specific from-source instructions for aces_container. I am on Mac OS X 10.12.5.

In attempting to compile rawtoaces, I get an error:

 Linking CXX executable rawtoaces
ld: library not found for -lAcesContainer

I assumed that this meant that the dylib for AcesContainer could not be found, so I added the path to it explicitly in the rawtoaces link.txt cmake file. Compilation then carried on with no errors. I installed the files using sudo make install. All good. But probably not.

When I run rawtoaces on a file and use verbose reporting, the processes in libraw appear to work, but no output file is written. I assume the end result should be an EXR file in the same directory as the source raw file. Presumably there is something not right with the aces_container part of the process.

I am not super knowledgable with respect to compiling and tracking down compiling problems, as is obvious in my brute force approach. What can I do to help track down my issue and solve it? BTW, the libAcesContainer.dylib file is installed in /usr/local/lib from the previous manual build from source for aces_container, per the instructions on GitHub.

Thanks in advance,

Kirk Thibault
Berwyn, PA USA

1 Like

You’re definitely correct that end result should be an EXR file in the same directory. What is your output during the make step of the aces_container compilation and the cmake .. step of the rawtoaces compilation?

I see this line in the former: [100%] Linking CXX shared library libAcesContainer.dylib

And this line in the latter: -- Found AcesContainer, version 1.0.1

I am also on OSX but it’s 10.11.6

Dear Kirk,

How are you?

Sorry for the late reply!

Since the process is printed and you cannot get a EXR file, the issue may be just related to “aces_container” installation. Can you try the following?

  1. Unlink and uninstall the current “aces_container” library and then just use “brew install aces_container” to install “aces_container”;
  2. If the issue remains, try to use “sudo ln -s /usr/local/Cellar/aces_container/1.0.1/lib/libAcesContainer.dylib
    /usr/local/lib/libAcesContainer.dylib” (may not need “sudo”)

Also, can you share the message printed out on the terminal when processing a RAW image by “rawtoaces”?

Please let us know.

Thanks and have a great day!

Mio

I’m out of the office, away from the machine that I originally was using to compile - I will try to reproduce the compile on my laptop (same OS version) and provide the requested feedback. I would guess there is an issue with the aces_container compilation, so the first thing I will try is to use the homebrew version (instead of the compile from source) and see if that results in a successful outcome.

Thank you for your help!

kirk

I went through the process again, brewing the prerequisites and building aces_container with homebrew. I cloned rawtoaces and made the build directory and entered it. Here is the terminal transcript for the cmake … and make commands:

Kirks-MacBook-Pro-2:build kirkt$ cmake ..
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found IlmBase, version 2.2.0
-- Found AcesContainer, version 1.0.1
-- Found LibRaw, version 0.18.2
-- Found installed version of Eigen: /usr/local/share/eigen3/cmake
-- Found required Ceres dependency: Eigen version 3.3.4 in /usr/local/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/local/lib/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.13.0 installed in: /usr/local with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, CXSparse, SchurSpecializations]
-- Found Boost_FOUND, version 106400
-- Boost version: 1.64.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   unit_test_framework
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kirkt/Desktop/RAWTOACES/rawtoaces/build
Kirks-MacBook-Pro-2:build kirkt$ make
Scanning dependencies of target rawtoaces_idt.0.1.0
[  8%] Building CXX object lib/CMakeFiles/rawtoaces_idt.0.1.0.dir/rta.cpp.o
[ 16%] Linking CXX shared library librawtoaces_idt.0.1.0.dylib
[ 16%] Built target rawtoaces_idt.0.1.0
Scanning dependencies of target rawtoaces_util.0.1.0
[ 25%] Building CXX object src/CMakeFiles/rawtoaces_util.0.1.0.dir/acesrender.cpp.o
[ 33%] Linking CXX shared library librawtoaces_util.0.1.0.dylib
[ 33%] Built target rawtoaces_util.0.1.0
Scanning dependencies of target rawtoaces
[ 41%] Building CXX object CMakeFiles/rawtoaces.dir/main.cpp.o
[ 50%] Linking CXX executable rawtoaces
ld: library not found for -lAcesContainer
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [rawtoaces] Error 1
make[1]: *** [CMakeFiles/rawtoaces.dir/all] Error 2
make: *** [all] Error 2

This is identical to the error I received on my other machine.

I also tried the sudo ln -s command suggested previously:

sudo ln -s /usr/local/Cellar/aces_container/1.0.1/lib/libAcesContainer.dylib /usr/local/lib/libAcesContainer.dylib

and received the following reply:

ln: /usr/local/lib/libAcesContainer.dylib: File exists

I reran cmake … and make and got the same error.

And here is the output of homebrew for aces_container:

Kirks-MacBook-Pro-2:~ kirkt$ brew install aces_container
==> Downloading https://homebrew.bintray.com/bottles/aces_container-1.0.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring aces_container-1.0.1.sierra.bottle.tar.gz
==> Using the sandbox
🍺  /usr/local/Cellar/aces_container/1.0.1: 20 files, 201.4KB

And here is a screen grab of the libAcesContainer.dylib (after linking with the ln command):

Kirk