RAW related functions for the scripts - Feature Requests - CHDK Forum

RAW related functions for the scripts

  • 26 Replies
  • 8556 Views
RAW related functions for the scripts
« on: 20 / November / 2008, 05:14:18 »
Advertisements
I would very much like to see a script that would turn on RAW, shoot N photos, average them, develop the result and delete all the RAW photos. That process is currently too complicated to be used often. Lua is already capable of basic file manipulation (store a list all the RAW files before the shooting, identify new RAW files after shooting, later delete these files). What it lacks is a function to average/sum a list of raw files and to trigger the RAW develop (automatically taking a shot afterwards to actually develop the photo). I really know nothing about CHDK development but it seems to me that this should be possible to implement (as opposed to a lot of weird requests posted here).

The main thing that determines the quality of the picture is the amount of collected photons. dSLR gives a better picture because it is a lot more efficient at collecting photons. A comparable picture quality can also be achieved using compact digital camera by using a longer exposure. If the ISO is already at the minimum, the only thing we can do to collect additional photons is to shoot and average multiple exposures. The same script can also be used for a long exposure effect that would otherwise require a ND filter (stream/waterfall photos with a 'blurry' water). By substituting average with sum we can also get a true 'bulb' mode with unlimited exposure for the night-time photography.
All in all, I think that a script like this would make this extremely powerful technique easily accessible even to complete novices. 
What do you think?

*

Offline lrossel

  • **
  • 53
  • CHDK - Take it underwater
    • My Photos
Re: RAW related functions for the scripts
« Reply #1 on: 20 / November / 2008, 06:16:38 »
Sorry if my question sounds stupid.

What is the benefit of doing what you suggest?
There is a relation with HDR photography?
If you saw me on land, It was just the surface interval
G10 without CHDK

Re: RAW related functions for the scripts
« Reply #2 on: 20 / November / 2008, 07:28:24 »
No, there is no direct relation with the HDR. It is theoretically possible to get a slightly better dynamic range by averaging slightly different exposures but nowhere near the dynamic range you would get by combining five 2EV bracketed shots with the enfuse.
What you get is a _drastically_ reduced noise with all the processing done automatically for you right on the camera. If you have a tripod and shoot a static subject you really get a high quality photo. Here is a comparison of a 10 exposure average and a single shot:

It's a lot easier to later process such a noise-free photo (you can sharpen it without amplifying the noise, get more data from the shadows...).
Also, as I have already said, you can do a 'long exposure' photos in situations that have too much light to get a decent motion blur effect (running water, waves...) and do exposures longer than 65s.
« Last Edit: 20 / November / 2008, 07:29:55 by dsvilko »

*

Offline lrossel

  • **
  • 53
  • CHDK - Take it underwater
    • My Photos
Re: RAW related functions for the scripts
« Reply #3 on: 20 / November / 2008, 10:43:05 »
Thanks for your explanation. It was very clear.

Did you study the scripts and lua information ? maybe there are functions to do what you want.

http://chdk.wikia.com/wiki/UBASIC
If you saw me on land, It was just the surface interval
G10 without CHDK


Re: RAW related functions for the scripts
« Reply #4 on: 20 / November / 2008, 12:01:12 »
Yes, I did go through the ubasic/lua documentation and I know how to write scripts in both but, as the subject says, some of the needed raw related functions are not available for scripting. Two functions, to be precise. One that would take a lua table of raw filenames and either average them or add them and maybe return the filename of the resulting raw file. The other function would initialize the raw develop on the raw file passed as the parameter (with or without the shoot() call). I believe all the other necessary functions are available in lua.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: RAW related functions for the scripts
« Reply #5 on: 20 / November / 2008, 12:51:23 »
This sounds highly useful to me, mainly because storing a dozen RAW files takes a huge amount of card space compared to a single JPEG. My camera is horribly noisy, so I'd definitely find use for such a script. Personally I don't care much about in-camera processing because things can be done so much faster and with better quality on a PC where it's just a matter of creating a simple application or script, but this one definitely trips my usefulness threshold.  :D


I think RAW average may already be sort of possible to in Lua, because if I'm not mistaken it can open, read, seek and write binary files. Of course, CHDK already has RAW average code in it, written in C and probably executes faster than what Lua code could achieve. It probably shouldn't be very hard at all to add access to functions of core/raw_merge.c to Lua along with raw develop...

Re: RAW related functions for the scripts
« Reply #6 on: 20 / November / 2008, 17:05:18 »
I can't agree more! Most of the heavy processing is far better done on the PC side. Trivial RAW arithmetics is probably the limit of what is realistically possible to do in the camera but it is a feature that is potentially so useful that it should be made more convenient to use. 
Another possible use of a scriptable raw_develop... Ask yourself, why do people shoot raw on the compact cameras? Dynamic range is only marginally better in raw (12bit?) and getting a good looking color from RAW is problematic at best (I didn't have much luck with it). The only thing I like about RAW is that there is no NR applied. A good NR software on the PC can certainly get more out of raw data. Now consider a trivially simple script:

turn on raw
shoot
set ISO to 50
raw_develop
delete raw
restore ISO

Now, shooting at ISO 800, beside a 'standard' jpeg you also get another with almost no NR applied! I have just tested it and the developed jpeg is a bit more noisy but it also has a lot more detail and a far brighter, more saturated color!
You could even leave a ratio of a original ISO and developed ISO as a parameter and have a very fine-tunable level of NR.
You could also automatically produce a few jpegs with different curves applied during development which can come in handy in situations when you need a higher DR but can't afford bracketing and don't want to mess with the RAW files on the PC.
And these are just a few things I thought of in the last 5 minutes. :)

*

Online reyalp

  • ******
  • 12586
Re: RAW related functions for the scripts
« Reply #7 on: 21 / November / 2008, 01:53:19 »
Here's a patch to do this. Untested.

You could *almost* implement the raw functions in lua itself, but it would be fairly inefficient.
Don't forget what the H stands for.


Re: RAW related functions for the scripts
« Reply #8 on: 21 / November / 2008, 05:00:51 »
That was fast! :) Unfortunately, I currently don't have enough time to figure out how to compile CHDK (is the linux howto on the wiki up to date?) but would very much like to test this on my S3. Is anyone out there willing to provide a patched binary for the S3? Thanks!

I did a few more tests with the ISO800 images using ISO50 development and processing them with Neat Image and the result is far superior than the one you can get by processing the 'standard' ISO800 image. And by using a raw_develop in the camera you get the excellent Canon color and don't even have to carry around a bunch of RAW files.
Here is the comparison (I forgot to lock to WB so it was not quite the same when I did the raw-develop):

« Last Edit: 21 / November / 2008, 05:02:37 by dsvilko »

*

Offline whim

  • ******
  • 2022
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: RAW related functions for the scripts
« Reply #9 on: 21 / November / 2008, 05:15:04 »
@dsvilko

I'll do one, if reyalp doesn't beat me to it  :D
S3, but which firmware version ?

edit: sorry, dumb ! there's only 1  :D

attached modded '586

edit2: removed attachment
« Last Edit: 21 / November / 2008, 09:16:47 by whim »

 

Related Topics