supplierdeeply

Dark Frame (Noise reduction) command

  • 7 Replies
  • 4404 Views
Dark Frame (Noise reduction) command
« on: 13 / November / 2010, 20:37:27 »
Advertisements
Hello,

I wonder, whether is there an command in uBasic, which allows me to take a dark frame (noise reduction) as a photo. Something like "shoot dark" or similiar. Can anyone help?

Thanks in advance!

Martin

*

Offline reyalp

  • ******
  • 11583
Re: Dark Frame (Noise reduction) command
« Reply #1 on: 13 / November / 2010, 21:41:38 »
Unfortunately, you cannot take a dark frame alone using CHDK.

You can enable/disable canon darkframe subtraction using set_raw_nr (0 = auto, 1=always off, 2=always on) but this just controls whether a darkframe is taken with normal exposures, it doesn't allow you to take just a dark frame by itself.

Note that the name is misleading: it applies to jpeg as well as raw, and doesn't control other forms of noise reduction that the camera might do.
Don't forget what the H stands for.

Re: Dark Frame (Noise reduction) command
« Reply #2 on: 13 / November / 2010, 21:59:16 »
Thanks for your answer, reyalp!

I know set_raw_nr command, but I would prefer to get 10 "light" exposures in a row first, then 1 "dark" exposures and do the subtraction manually. (Yes, astrophotography. :-)) Well, thanks for confirmation, that it is not possible.

Martin

*

Offline reyalp

  • ******
  • 11583
Re: Dark Frame (Noise reduction) command
« Reply #3 on: 13 / November / 2010, 22:08:50 »
If you are willing/able to do some hacking, you may be able to do this. Possibly in lua using eventprocs, or in CHDK code itself. See http://chdk.setepontos.com/index.php?topic=1365.msg12384#msg12384

You can also recover an approximation of the dark frame doing one exposure with DFS, one without, and then subtracting the one with from the one without.
Don't forget what the H stands for.


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Dark Frame (Noise reduction) command
« Reply #4 on: 14 / November / 2010, 09:21:55 »
Yep, appears to work in Lua, see attached test script.

I didn't find a way (didn't look very deep, though) to register OpenMShutter and CloseMShutter eventprocs in the (vxworks camera) a570, so used direct func ptr calls for my a570 100e instead. The script assumes that in dryos you can register them with Mecha.Create and use them with OpenMechaShutter and Close*. I don't have a dryos cam to tests that, though.

*

Offline reyalp

  • ******
  • 11583
Re: Dark Frame (Noise reduction) command
« Reply #5 on: 14 / November / 2010, 17:14:27 »
On a540 (vxworks) it looks like OpenMShutter and CloseMShutter should be registered with InitializeAdjustmentFunction

Untested.

edit:
ref http://chdk.wikia.com/wiki/User:ReyalP/EventProcNotes#InitializeAdjustmentFunction
Don't forget what the H stands for.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Dark Frame (Noise reduction) command
« Reply #6 on: 14 / November / 2010, 17:53:31 »
Thanks reyalp, I keep forgetting to check that page of yours...  :D

Anyway, InitializeAdjustmentFunction seems to do the trick on a570, updated script attached. It can now be used to easily test known variations (eventprocs *MShutter or *MechaShutter, eventproc registration using Mecha.Create or InitializeAdjustmentFunction, and direct function calls by entry point).



*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Dark Frame (Noise reduction) command
« Reply #7 on: 16 / November / 2010, 17:01:20 »
Okay, another script, this time a bit more practical one: it shoots a photo and then another one using the same exposure settings with shutter closed to get a dark frame.

It seems to work for me on a570 (native calls enabled, of course) and it should work on many others but I really don't know which unless someone tests it or runs batch fw analysis. I made a simple guess (likely incorrect) that all vxworks cameras use one method and all dryos another one. No harm should be done to the camera by the script if that assumption ends up being incorrect. If it doesn't work for you, use e.g. my previous script to debug.

Notes from the script text:

Code: [Select]
Shoots a RAW photo and a RAW dark frame.

The dark frame will be shot using the same exposure parameters as the actual
photo, but it is not shot using Canon's automatic dark frame feature (instead,
a second photo is taken -- therefore you also get a useless(?) JPEG of the
dark frame).

The photo will use whatever exposure parameters the camera would normally
use without the script,  i.e. Canon's manual exposure or autoexposure and CHDK
exposure overrides should work as expected if they are active. Focus shouldn't
make a difference if the mehcanical shutter is between lens and sensor. Similarly
ND filter state shouldn't affect results.

The script requires native calls to be enabled in your CHDK build. They are not
enabled in CHDK autobuilds by default. Set OPT_LUA_CALL_NATIVE=1 in builconf.inc
and rebuild to enable them.

The script assumes all vxworks cameras to have InitializeAdjustmentFunction
eventproc, and it to register CloseMShutter eventproc. For dryos, it assumes
Mecha.Create eventproc to register CloseMechaShutter eventproc. If neither is not
true for your camera, the script will fail to work. It will most likely either
exit due to an error before shooting, or warn about the shutter close command
and shoot two normal RAW+JPG photos instead of a photo + dark frame pair.


 

Related Topics