On 2/12/10, Lars Tore Gustavsen <lars.tore@xxxxxxxxxxxxxx> wrote: > On Thu, Feb 11, 2010 at 8:30 PM, Elle Stone <l.elle.stone@xxxxxxxxx> wrote: > I also like your planned -R option that > let the user "Read in Argyll camera coefficients" without recompile. > It would of course be even easier for the end user if that file was an > icc file and dcraw-undnged found the inverse solution by itself. > > > I just had to make a simple bash script to create the inverse matrix. :-) > > #!/bin/bash > if [ $# -eq 0 ] > then > echo "Usage:$0 iccfile" > exit > fi > > matrix=$( iccdump -v3 -t rXYZ -t gXYZ -t bXYZ $1| grep \] |cut -c 9-37) > inversematrix=$(echo "inv([$matrix])" | octave -q) > inversematrix2=$(echo $inversematrix|cut -f 2- -d =|awk '{print > $1,$2,$3",",$4,$5,$6",",$7,$8,$9 }') > echo $inversematrix2 > > Hi Lars, Actually you can already read in Argyll camera coefficients. If the program finds a file named "colprof.inverse" in the same directory as the raw file, it will read in and use the coefficients in colprof.inverse. The format for the coefficients needs to be line-separated values like this: 1.422877 -0.339392 -0.186022 -0.485458 1.164846 0.229688 -0.098321 0.197318 0.971034 0.000000 0.000000 0.000000 Unfortunately I haven't yet figured out how to get C-code to open a file with a name specified at the command line. Your bash script looks like just the ticket to get coefficients from an icc profile. There is also already a function in dcraw (pseudoinverse) that finds the inverse of a matrix, but I haven't tried to get it to do the work of finding the inverse of the camera primaries. Did you have a chance to modify the code for your camera and coefficients, then compile and run? Did it work? The code as it stands, with no further modification, only works with a Canon Rebel xti/400D. It has to be customized to the camera and the profile. Regards, Elle