Manually setting up camera (iso, shutter, etc...) - Script Writing - CHDK Forum

Manually setting up camera (iso, shutter, etc...)

  • 5 Replies
  • 5168 Views
Manually setting up camera (iso, shutter, etc...)
« on: 30 / September / 2011, 19:04:01 »
Advertisements
I'm in the process of working on an app using PTP to communicate with the camera, and then LUA to actually control it... I've got most of what I would have considered to be the harder things done, for instance I get the display from the back of the LCD and display it in my program (corrected for aspect), I can copy files off of it, and I can do some of the controlling of the device, and I can control multiple cameras at the same time.  Ideally I would like this to work on any chdk camera - currently I'm testing it on a SD1100IS, SD1200IS, SD1200IS, SX30IS and SX130IS.  For me development, I'm working on the SX130IS most of the time.

The first thing I do is set the camera to manual mode via:

capmode=require('capmode') capmode.set('M')

I then focus once and lock:

set_aflock(0);set_aflock(1);

I can get zoom working properly using get_zoom(), set_zoom(), get_zoom_steps() and set_zoom_speed().  It seems to work consistently between all cameras.

I can get focus working properly using get_focus(), set_focus().

I can control the flash using set_prop(props.FLASH_MODE, x).

Where I'm totally stuck, and can't seem to get working any way is shutter and exposure... I've tried using set_iso_real()/get_iso_real(), but this is what happens:

cmd: get_iso_real();
rtn: 93
cmd: set_iso_real(400);
cmd: get_iso_real();
rtn: 93
cmd: set_iso_real(800);
cmd: get_iso_real();
rtn: 93

I also tried set_iso_mode(), but nothing was reflected on the LCD screen on the device. 

I've read about set_sv96/get_sv96, and they seem like they might have something to do with it, but I haven't been able to make heads or tails out of it yet.

Any help would be greatly appreciated - if I can get this working reasonably well with all the devices I have, then I plan to release it for others to use, but if I can't resolve these issues than I'm probably just going to have to figure out some other way to do things.  I know chdk can do what I want, it's just frustrating not being able to figure out how...

Thanks for any help or insight anyone can share!
SD1100IS / SD1200IS / SX130IS / SX30IS

Re: Manually setting up camera (iso, shutter, etc...)
« Reply #1 on: 30 / September / 2011, 19:38:48 »
Does this help ?  Its my simple HDR script.

Code: [Select]
--[[
@title High Dynamic Range
--]]

set_aflock(1)

print("1) normal")
  shoot()

  p=get_av96()
  s=get_sv96()
  t=get_tv96()

print("2) bright")
  set_tv96_direct(t-192)
  set_sv96(s)
  set_av96(p)
  shoot()

print("3) dark")
  set_tv96_direct(t+192)
  set_sv96(s)
  set_av96(p)
  shoot()

set_aflock(0)
print("...done")

There are more elaborate & elegant versions on the forum,  such as :
msl's universal bracketing
« Last Edit: 30 / September / 2011, 19:53:52 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14125
Re: Manually setting up camera (iso, shutter, etc...)
« Reply #2 on: 30 / September / 2011, 23:41:00 »
Note that the shooting related set_* functions are special... they generally set the propcase value after shooting has started. The get functions just return the propcase value. So setting and then getting immediately shouldn't be expected to return the value you just set!

The *96 function work in APEX*96 values. You can find a very good description of APEX here: http://dougkerr.net/pumpkin/#APEX

camera APEX values are multiplied by 96 to allow the calculations to be done with integers.

edit:
Just to be clear, this was in response to newmedia42 original post, not waterwingz script.
« Last Edit: 01 / October / 2011, 00:30:55 by reyalp »
Don't forget what the H stands for.

Re: Manually setting up camera (iso, shutter, etc...)
« Reply #3 on: 01 / October / 2011, 00:27:47 »
FWIW ... the script I posted works. 

Reyalp's comments point out that if you set values with set_* and then use get_*, you will not get back the values you set.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Manually setting up camera (iso, shutter, etc...)
« Reply #4 on: 01 / October / 2011, 01:02:48 »
Hugely helpful comments - so basically a shoot() needs to occur before the values are really even valid then, eh?  For example, I manually did
get_av96(), get_sv96(), and get_tv96(), and they all just returned 0 - but, once I performed a shoot(), then they returned values.  I also found that I could perform the set's as with waterwingz example and get the same result, so that now gives me what I need on that front - plus the link reyalp gave is super, I'm looking over it now to figure out exactly how I'm going to integrate.

One question though - while the pictures now reflect the changes, the actual LCD screen does not.  The data on it shows the same values as always, and the image is always very dark.  Is there something special I need to do to correct this?  I was hoping to use the preview to, well, preview the settings, but right now it's completely different than what actually happens when I shoot.
SD1100IS / SD1200IS / SX130IS / SX30IS

Re: Manually setting up camera (iso, shutter, etc...)
« Reply #5 on: 01 / October / 2011, 01:14:25 »
Hugely helpful comments - so basically a shoot() needs to occur before the values are really even valid then, eh?
Actually,   you can do something like this if you don't want to capture an image first

Code: [Select]
press("shoot_half")
repeat sleep(50) until get_shooting() == true
release("shoot_half")
p=get_av96()
s=get_sv96()
t=get_tv96()


Haven't looked at the LCD screen issue - sorry.  I was just happy when the EXIF values in the actual images showed the override values I had set.

Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal