Histogram - page 9 - General Discussion and Assistance - CHDK Forum

Histogram

  • 109 Replies
  • 30129 Views
Re: Histogram
« Reply #80 on: 20 / January / 2013, 22:45:26 »
Advertisements
Lapser

Tried your shoot_full_only but I get a strange result. Here is the function I am using:

function brighter(bright_tv)
    repeat
   bright_tv = bright_tv - ev_step
        set_tv96_direct(bright_tv)
   set_focus(fdis)
   press("shoot_full_only")
   repeat sleep(10) until get_shot_ready(0)
       release("shoot_full_only")
   Tv=get_tv96()
   histo = get_histo_range(127, dark,0)
   if Tv < -382 then histo = 0 end
    until histo < th_dark
end

Every iteration I print out bright_tv and histo, to check it is working ok, which it is not.

Bright_tv changes as expected, but the image exposure doesn't change, ie it looks like set_tv96_direct does not change the exposure. When I look at the images, they are all at the same exposure.

I would be grateful for any insight you may have, as I thought I had used the calls as you suggested.

Cheers

Garry

*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #81 on: 20 / January / 2013, 23:48:03 »
Every iteration I print out bright_tv and histo, to check it is working ok, which it is not.
Bright_tv changes as expected, but the image exposure doesn't change, ie it looks like set_tv96_direct does not change the exposure. When I look at the images, they are all at the same exposure.
Thanks for trying it out. I know you need to take out the set_focus statement. It's not needed in half_shoot. I'm not sure if that's the problem, but set_focus doesn't work in half shoot.

Are you in continuous drive mode? If so switch to single.

The only other thing I can think of is to try using get_shot_ready() without the 0 parameter. That will give the script 100 msec to set the exposure before the next shot starts.

It might be helpful for you to try a simpler script:

Code: (lua) [Select]
ev=-3
press("shoot_half")
repeat sleep(10) until get_shooting()
tv96=get_tv96()
repeat
  set_tv96_direct(tv96+ev*96)
  press("shoot_full_only")
  repeat sleep(10) until get_shot_ready()
  release("shoot_full_only")
  ev=ev+1
until ev>3
Then look at the pictures to see if the exposure changes.

I've also attached the histogram test script I wrote, which may be instructive.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Histogram
« Reply #82 on: 21 / January / 2013, 01:30:14 »

Active area for G11
    #define CAM_ACTIVE_AREA_X1              16
    #define CAM_ACTIVE_AREA_Y1              8
    #define CAM_ACTIVE_AREA_X2              3692
    #define CAM_ACTIVE_AREA_Y2              2776


Based on the sample image from pigeonhill the G11 active area has the X1 and Y1 values swapped.

I'll update SVN with the correct values.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #83 on: 21 / January / 2013, 01:58:43 »
Based on the sample image from pigeonhill the G11 active area has the X1 and Y1 values swapped.
I'll update SVN with the correct values.
Thanks Phil.

Attached is a new build with X1 and Y1 corrected as Phil suggests. See if this works without set_shot_meter(1,1,1,99,99).
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Histogram
« Reply #84 on: 21 / January / 2013, 09:26:49 »
All

I can confirm the latest build from lapser is stable and works as expected on the G11, ie histogram call, when NOT using set_shot_meter(1,1,1,99,99), works as expected, CHDK histogram data is zero when in need there is no image data there (according to RawDigger).

Cheers

Garry

Re: Histogram
« Reply #85 on: 21 / January / 2013, 10:21:03 »
lapser

Got the shot_full_only working and it's transformed my script, ie much faster!! Thanks.

The 'secret' was to put the camera into continuous mode, ie it didn't work in single mode.

BTW I see I can test for what mode the camera is in (get_drive_mode), is there a way to set the mode in a script, ie a set_drive_mode function? I can see one on the scripting cross reference page.

Cheers

Garry

*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #86 on: 21 / January / 2013, 11:32:16 »
I can confirm the latest build from lapser is stable and works as expected on the G11, ie histogram call, when NOT using set_shot_meter(1,1,1,99,99), works as expected, CHDK histogram data is zero when in need there is no image data there (according to RawDigger).
Great. It should be fixed in the trunk by now.
Got the shoot_full_only working and it's transformed my script, ie much faster!! Thanks.
The 'secret' was to put the camera into continuous mode, ie it didn't work in single mode.
It may not be working in single mode if you don't do the initial:

press("shoot_half")
repeat sleep(10) until get_shooting()

Will you add that and try it again in single mode? It should go near the beginning of the script, outside any shooting loops. Thanks.
Quote
BTW I see I can test for what mode the camera is in (get_drive_mode), is there a way to set the mode in a script, ie a set_drive_mode function? I can see one on the scripting cross reference page.
I haven't discovered a way to change the drive mode to continuous or single, but that would be wonderful. I'm hoping one of the expert hackers will figure out a way. There is a way to toggle the focus mode between manual and auto:

  post_levent_for_npt("PressSw1AndMF") --toggles manual focus mode
  sleep(500)

Here's the way I handle single or continuous mode:
Code: (lua) [Select]
press("shoot_half")
repeat sleep(10) until get_shooting()

single=get_drive_mode()~=1
if(not single)then press("shoot_full_only") end
repeat
  if(single)then press("shoot_full_only") end
  repeat sleep(10) until get_shot_ready() -- waits for build_histogram --
  if(single)then release("shoot_full_only") end
..loop stuff here
until done

EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Histogram
« Reply #87 on: 21 / January / 2013, 11:51:48 »
lapser

Doing the shoot_half allows the script to run in single shot mode. It also fixes an anomaly I had spotted between the G11 and S95, in that the S95 seemed to miss a shoot, but the G11 didn't.

I guess the S95 must have a different buffer set up, as on the G11, when the script finishes the camera is instantaneously 'freed up'. On the S95 I get the 'busy' message and the green light flashes for quite a few seconds after the images are captured.

I have set up a Canon Custom menu that ensures my script is set up correctly, eg MF, non-IS, fized WB, single shot etc.

In other words, now my script seem to wiz through taking images, and I don't have to worry about how many brackets to take, I will 'always' use the auto-bracketing now.

BTW I still feel this auto feature would be a knock-out success if it featured in the trunk, ie select ++, --, +-+ or Auto.

Cheers

Garry

*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #88 on: 21 / January / 2013, 12:59:41 »
Doing the shoot_half allows the script to run in single shot mode. It also fixes an anomaly I had spotted between the G11 and S95, in that the S95 seemed to miss a shoot, but the G11 didn't.
It looks like shoot_half is necessary to trigger the initial metering.
Quote
I guess the S95 must have a different buffer set up, as on the G11, when the script finishes the camera is instantaneously 'freed up'. On the S95 I get the 'busy' message and the green light flashes for quite a few seconds after the images are captured.
That may also have something to do with how many images are on the card.

I've also noticed that in continuous mode, when shooting a lot of shots really fast, I get long pauses and sometimes script errors. It seems to be related to writing log data at the same time as saving a lot of pictures. It's worse with the larger picture sizes, and seems to go away when I don't write any log data.

Philmoz mentioned a problem with "too many file handles" that may be related, and that he closed and re-opened the log file to correct it. I'm not sure how that works, or what the file handle problem is, but I think I've got it.
Quote
I have set up a Canon Custom menu that ensures my script is set up correctly, eg MF, non-IS, fized WB, single shot etc.
That's a good idea. I haven't played with the Canon Custom menus much. You can also check a lot of things at the beginning of the script.
Quote
BTW I still feel this auto feature would be a knock-out success if it featured in the trunk, ie select ++, --, +-+ or Auto.
Have you found the bracketing in continuous mode feature in the CHDK enhanced photo operations menu? It works for Tv exposure bracketing on my sx260, but not for focus bracketing.

There's a continuous mode on my cameras WITH focus that may be useful under certain circumstances. I'll add a check for that in the future.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Histogram
« Reply #89 on: 21 / January / 2013, 13:13:35 »
lapser

I have been using CHDK bracketing in continuous mode for some years. The 'weakness' of this approach is that you need to know/guess the exposure extremes to ensure you capture the dynamic range, or over do the number of brackets.

On my 50D I have used Magic Lantern for some years, and in particular the (recent addition of) Auto Bracketing that Alex has put in there. I now use it all the time, ie I never have to worry about how many brackets to take, and I don't need to meter the extremes.

As I say, I will use my CHDK auto bracketing script every time I bracket now on my G11 or S95. I can really say it works well.

BTW here is my finished script. I'm sure the gurus could make it more efficient.

--[[
********************************
Auto Bracketing (based on soe Msl and Lapser ideas/scripts)
********************************
@title Auto Bracketing
@param a Ev steps 1/3
@default a 3
@range a 1 9
@param b bright bin width
@default b 50
@range b 1 90
@param h Tv plus (Ev)
@default h 0
@range h 0 5
@param c dark bin width
@default c 10
@range c 1 30
@param d start delay  in s
@default d 3
@param f x10 bright (1-20)
@default f 2
@range f 1 20
@param g x10 dark (1-20)
@default g 2
@range g 1 20
]]

function delay(sec)
    repeat
        cls()
        print("Start in ", sec, "second(s)")
   print(" ")
        sleep(960)
        sec = sec - 1
    until sec==0
    cls()
end

function fastshoot()
      press("shoot_full_only")
   repeat sleep(10) until get_shot_ready()
       release("shoot_full_only")
       pic_num = pic_num + 1
end


function brighter(bright_tv)
    repeat
   bright_tv = bright_tv - ev_step
        set_tv96_direct(bright_tv)
   fastshoot()
   Tv=get_tv96()
   histo = get_histo_range(127, dark,0)
   if Tv < -382 then histo = 0 end
    until histo < th_dark
end

function darker(dark_tv)
    repeat
        dark_tv = dark_tv + ev_step
        set_tv96_direct(dark_tv)
   fastshoot()
        Tv=get_tv96()
   histo = get_histo_range(bright,4095,0)   
   if Tv >= (1024 + h*96) then histo = 0 end

    until histo < th_bright
end

function restore()
   shot_histo_enable(0)
   release("shoot_half")
end

--script start
if d < 0  or d > 10   then d = 3   end
ev_step   = a * 32
bright    = 4095 - b - 1
dark = 127 + c - 1
delay_sec = d
th_bright = f * 10
th_dark   = g * 10
pic_num   = 0
shot_histo_enable(1)
fdis=get_focus()
set_focus(fdis)
press("shoot_half")
repeat sleep(10) until get_shooting()
if delay_sec > 0 then delay(delay_sec) end
fastshoot()
tv_start = get_tv96()
brighter(tv_start)
darker(tv_start)
print(" ")
print(pic_num, "images taken.")
print(" ")
restore()

 

Related Topics


SimplePortal © 2008-2014, SimplePortal