Exploring Foveon Raw / xf3-tools / profiles / tricks

archaiesteron

Active member
Messages
92
Reaction score
0
Location
FR
Hi, I finally decided to download the xf3-tools and to play a little with them. I built a workflow for creating a profile. I only had a time for a first attempt, but it looks interesting; in the next days, I will try to make it more accurate.

Some parts of my post are rather technical, but even if you are not interested by that, please download the profile and play with it (but read further in order to understand how to use it).

First, I use this thread for asking some features to the author of the xf3-tools:
  • it would be nice to have a stdout output (for using with pipes) like many unix tools ;
  • it would be nice to have a PNM output (remember that no library is needed; it should need 5/10 minutes for implementing that; many unix tools handle PNM; it is a very useful format (you can easely convert it to ASCII in order to perform some script-based changes or numerical analysis) ;
  • it would be nice to have a PNM output with a 12bits declaration (it is the very same thing than previous request: 12-bits values from the RAW file encoded in 16-bits integers), but instead of claiming the values are from 0 to 65535, you can tell they are rather from 0 to 4095; the data by themselves are the same, but when loaded by any software, they will be stretched to 0-65535, which would avoid a further step.
Now, here is what I did:
a) choose a picture with ISO 100, good exposure, and a good number of colors;

b) use SPP for saving a 16-bits ProPhoto of the picture with all settings to 0 (except sharpening to 0.8 according to http://forums.dpreview.com/forums/read.asp?forum=1027&message=38626893 )

c) use xf3-tools for getting the RAW data; multiply it by 16 (because the datas from the RAW are 12-bits), which is very easely achieved by
convert input.tif -level 0%,6.25% output.tif
d) crop the raw picture (in order to make it match the SPP version)
e) select 1,500 random pixels and get values from the RAW and from SPP for
all these pixels;

f) convert the ProPhoto datas from SPP to XYZ colorspace: http://brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html

f) write some custom TI3 file : http://www.argyllcms.com/doc/ti3_format.html with both datas (XYZ from SPP and RAW); the following page was a good template (but I discarded the three last columns): http://www.freelabs.com/~whitis/reviews/230X_USB_Microscope/Camera.ti3

g) convert the TI3 to a color-profile ICC with Argyll according to http://www.argyllcms.com/doc/Scenarios.html#PS4 (see the paragraph beginning with "If profiling a camera in RAW mode")

I did it with three pictures, but unfortunately I have no good picture with many colors. If someone could send to me a 100 ISO / RAW with many many many colors... One of the three ICC profiles was obviously better and more portable than the others. It is not perfect but it is certainly a good start.

Now the profile is there: http://dl.free.fr/d1QzZsF57
Use it after having scaled the 12-bits data. You can do this:

convert my_sdim_picture.X3F.tif -level 0%,6.25% +profile icm -profile SDIM0738_data.icc -profile usr/share/color/icc/sRGB.icm out.tif

Of course you need some sRGB profile (you may find it in the icc-profiles package on Ubuntu distributions). You can use other tools, but don't forget to scale the linear data.
 
One thing to remember - each camera has different calibration matrix. If you want to create profile from images from many cameras, then you should perform color conversion first. Not problem for SD9/10/14, unsolved (so far) for newer cams. Well, if you manage to build matrix profiles for some newer camera, then maybe we can solve color conversion problems either :)

Another thing - use some known color target, like colorchecker card (presumably bigger one - SG - with 140 patches) or IT 8.7 scanner calibration target or QPCard. SPP output is not ideal (although looks nice).

--
Arvo
Sigma/Foveon information collection and little gallery:
http://www.stv.ee/~donq/sigma.htm
http://www.stv.ee/~donq/images.htm
 
Hi, I finally decided to download the xf3-tools and to play a little with them ...
Nice that you have use of my tools. Its late and I am tired right now ... but I shall read what you have done later. You had some questions though ...
First, I use this thread for asking some features to the author of the xf3-tools:
  • it would be nice to have a stdout output (for using with pipes) like many unix tools ;
Agree ... its on my todo from now. Maybe also read from stdin. Not hard to implement either.
  • it would be nice to have a PNM output (remember that no library is needed; it should need 5/10 minutes for implementing that; many unix tools handle PNM; it is a very useful format (you can easely convert it to ASCII in order to perform some script-based changes or numerical analysis) ;
Already there! You can get both 16 bit ascii and 16 bit binary PPM. Use the switches -ppm-ascii and -ppm.
  • it would be nice to have a PNM output with a 12bits declaration (it is the very same thing than previous request: 12-bits values from the RAW file encoded in 16-bits integers), but instead of claiming the values are from 0 to 65535, you can tell they are rather from 0 to 4095; the data by themselves are the same, but when loaded by any software, they will be stretched to 0-65535, which would avoid a further step.
Hmmmmm ... I am not sure about the general support for 12 bit PPM. And I do think you have to do some manipulation anyhow. And if you set gamma in the tool the result will be stretched to 16 bit. So ... if you dont give me more motivation I think it is not on my todo :)

--
Roland

support http://www.openraw.org/
(Sleeping - so the need to support it is even higher)

X3F tools : http://www.proxel.se/x3f.html
 
OK, I think I have something. Since the method appears to work, I will do it again with more values and try to have better values, but I already have something quite good with the following matrix:
  • Multiply 12bits value by 16 (for scaling the values to full 16bits)
  • Convert from linear RAW to XYZ with
0.081830, 1.534943, 0.986649,
-2.88879, 4.199142, 0.644897,
-0.610947, -2.764038, 5.341125
  • Convert from XYZ to linear sRGB with
3.2404542, -1.5371385, -0.4985314,
-0.9692660, 1.8760108, 0.0415560,
0.0556434, -.2040259, 1.0572252
  • Apply sRGB gamma
I use ImageMagick for the whole process like that:

convert - -evaluate multiply 16 -recolor 0.081830,1.534943,0.986649,-2.88879,4.199142,0.644897,-0.610947,-2.764038,5.341125 -recolor 3.2404542,-1.5371385,-0.4985314,-0.9692660,1.8760108,0.0415560,0.0556434,-.2040259,1.0572252 -gamma 2.2 -resize 720x720 show:

(of course gamma 2.2 is not the real sRGB gamma; I actually use pnmgamma for the exact sRGB curve, but the command above gives something good anyway).
 

Keyboard shortcuts

Back
Top