This is very neat stuff, very powerful. I just realized (it may be just me that is slow) that the curves can be used to change EV values when developing. I am not sure that this can be done just by multiplying or dividing the data by constants. I did some tests and although it works there seems to be a color shift for large multipliers/divisors. But for small increase in EV it works nicely. Say multiply by 1.5 or .75 in the code below.
I have hope that it will be possible to figure out curves that develop at various +/- EV and preserve color.Hopefully these curves could be created on the fly or loaded automatically. That way someone would not have to master the details of using curves to simply brighten up a photo.
The overall implementation of the curve is FLAWED and would barely work for multipliers/divisors. That's why things seems to work at some extend for you.The color shift is due to the non linear response of the RAW data. Since the non linear response of the sensor is not known, it will be very hard to work out something to correct it.
Do you mean that the whole idea of using curves is flawed? If so I think that you are too pessimistic. For instance, one curve certainly works great: the identity curve. Others will probably work well also, the trick is to figure out what sort of curves will work.
The trick is to know what the black value is for your sensor. This is the nominal value that the sensor records when there is no light.
Take a picture of a scene with a black object (inside of a pipe, say) and save the raw data. Outside the camera I used dcraw -D -4 CRW_1815.CRW. This produces a 16bit image of the raw data. ImageJ can read such data. Looking at the values in the pipe interior I saw that they averaged about 32 (ISO80,A720IS). This seemed to be the same for the R,G,B sensors. I think the black value is also the same for other ISO's, but will need to do more testing.Now to increase or decrease the ev I set mult to what I want (say 2 for ev +1 or .5 for ev -1) and calculate offset = black - mult * black. (i.e. this effectively subtracts black before doing the mult and adds it back after).
You may want to avoid all the pain if you use the GetPixel.exe that I attached in an earlier post.
I tried getpixel and it works great. Question: how do you determine the raw coordinates of a pixel from the coordinates in an image?
Since I'm often slightly under-exposing (-2/3 EV) to avoid blow-out, I'm looking for a curve to bring out the shadows (a-la D-Lighting in Nikon DSLRs).
Does anybody have a library of already-made curves or at least a link to a website where various useful/fun curves are shown visually?