CHDKPTP based Photoboot - Script Writing - CHDK Forum

CHDKPTP based Photoboot

  • 9 Replies
  • 6922 Views
CHDKPTP based Photoboot
« on: 03 / February / 2016, 13:36:05 »
Advertisements
Hello to every one.
I have a project in my mind and I ask your opinion about  feasibility..
my idea is a photoboot based on a simplified version of CHDKPTP GUI
Only one page with live preview and a START Button
when the start button is pressed after a 5 second count down the camera shot every 5 second for 4 times.
After that the camera is turned in play mode and the 4 images are downloaded and processed to form a photoboot strip like this : http://sparkbooth.com/
after the photo merge will be nice to send the result to a printer and/or e-mail address.
In the next days I'll try to perform the simplified gui and the shooting script...
Any Ideas to realize the post processing?

Re: CHDKPTP based Photoboot
« Reply #1 on: 03 / February / 2016, 16:00:42 »
I did something exactly like that last year using a raspberry pi, a 24" LCD monitor, CHDKPTP, a Canon powershot running CHDK, and a big box full of costume props.   If you are interested I could publish some build info.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDKPTP based Photoboot
« Reply #2 on: 03 / February / 2016, 17:16:15 »
I'm very interested in your project.... please tell me more about it! :)
« Last Edit: 03 / February / 2016, 17:19:11 by shallappa »

Re: CHDKPTP based Photoboot
« Reply #3 on: 06 / February / 2016, 02:51:52 »
Im working on Gui.lua of CHDKptp
I have created the start button as follow...
At the moment execute the count down with sound and led blinking
Code: [Select]
iup.button{
title='START',
size='94x15',
action=function(self)
gui.execquick([[
set_lcd_display (0)
set_record (1)
set_capture_mode (0)
set_led (9,1)
play_sound (2)
set_led (9,0)
sleep (1000)
set_led (9,1)
play_sound (2)
set_led (9,0)
sleep (1000)
set_led (9,1)
play_sound (2)
set_led (9,0)
sleep (1000)
set_led (9,1)
play_sound (2)
set_led (9,0)sleep (1000)
set_led (9,1)
play_sound (6)
set_led (9,0)
]])
            end,
but I don' t kwow how to concatenate the cli command Rs
I tried:
Code: [Select]
!cli:execute("rs")but didn't work :(
Maybe could be easier using only cli command?
How can I associate a button to list of cli commands?

Re: CHDKPTP based Photoboot
« Reply #4 on: 06 / February / 2016, 10:43:45 »
I'm very interested in your project.... please tell me more about it! :)
Here's a quick rundown.  I had bigger plans but as usual, ran out of time. But what I got working was a big success and it ran automatically all night so that I did not have to 'babysit' it.

Equipment
  • Canon Powershot Camera (in my case a G10 - which has a hot shoe for a flash - see below for more about that)
  • Canon 270EX II Flash unit
  • Raspberry Pi 2 (you could use an original Pi but the faster one is nicer when displaying images)
  • PifFace digital I/O expander
  • a small portable wireless keyboard/mouse combo unit
  • a 14" TV with HDMI input
  • a 27" TV with HDMI input
  • an HDMI splitter
  • Several LED flood lights (available from most hardware stores like Home Depot)
  • Tripods (for camera and LED flood lights
  • an "Easy" button from Staples
  • assorted A/C power supplies for the camera & flash unit, power cords, and cables.
  • a curtained off area
  • a huge box of costume props

In my setup, the camera was setup to autoboot CHDK but all the control logic resided in the Raspberry Pi.

The Pi ran a Raspian Wheezy image.  There was nothing specific about that, it's just what I had. I installed the feh package and used it to display images.  I then set it up to build chdkptp from source on the Pi, so I had to download and install the IUP and CD development stuff.  In hindsight, I'm not sure this was strictly necessary - reyalp's pre-built version would probably have been enough.  But when I started I planned to integrate the photobooth code fairly closely with chdkptp. As I ran out of time, I started just invoking it from the command line (using C's system() call) to tell the camera to shoot and download. So the whole chdkptp gui was not needed - but I did not know that when I started out.

The basic setup was :
  • the "Easy" button was modified/converted to be a N.O. dry contact switch that was used to start the photo sequence when pressed
  • the button was wired to a digital input on the PiFace board
  • the PiFace board also controls a second relay that switches line voltage, turning on & off the flood lights
  • the raspberry pi is connected to the camera using a standard USB cable
  • the wireless remote connects via a USB dongle to the Pi
  • the two monitors are connected to the HDMI output of the Pi via a HDMI "splitter"
  • the smaller monitor is turned to face the people in the photobooth
  • the larger monitor is positioned outside the photobooth so that everyone can see what it happening.
I suppose I could draw a diagram of this at some point.

I've attached the C code that I used on the Pi.  It's not elegant and could have been done in other ways (including Lua under chdkptp).  All I'll say is that for me, it was the fastest way to get the code working as I ran out of time.  I did all the development work directly on the Pi - another time saver.

Basic functionality is :
  • Runs in slideshow mode when system is idle - sending random images from the session to both monitors
  • When someone presses the "Easy" button,  it starts the shooting sequence
  • Shooting sequence consists of a series of "slides" or fixed graphics
  • The first slide tells people to press the button while looping through a live image of the current scene
  • Once the button is pressed,  the screen counts down from 5 using slides with large numbers
  • At the start of the countdown,  the photo flood lights turn on.
  • The camera shoots four times
  • the photo flood lights turn off
  • The resulting images are assembled on an image strip and displayed.
  • The script goes back to step 2 (above)
  • If nothing happens for a while,  the script goes back to step 1


Notes about Lighting
  • Lighting can be tricky and was the biggest challenge.
  • There are many photobooth web pages online giving lots of advice about lighting. Most of it is not very good.
  • I started using really bright LED construction flood lights from Home Depot
  • The LED's photolamps don't mind being cycled on/off.  That's why I used them instead of cheaper halogen bulbs
  • the effect on people of turning the lamps on when the camera was ready to shoot was beneficial
  • The LED flood lights were barely adequate at maximum aperture, ISO 800, and 1/30 second shutter speed. This was too slow to freeze motion if someone moves, and ISO800 on my G10 is very noisy.
  • I reverted to using my external flash unit in addition to the LED lamps.  The flash was mounted above the camera to minimize red-eye. If there had been a ceiling in the venue, I would have tried bouncing the light off that.
  • My original concern about the flash unit was battery life as I don't have an AC power supply for it. I had lots of spare batteries but the original set lasted the night.

Notes about the booth : Pay attention early to the background in your booth. I got lucky on this project as the venue we used had portable black curtain room divider that we were able to use to setup a "booth".  However, in a few shots,  people succeeded in kicking the curtains and separating them, resulting in a visible seam behind them.  Quite annoying.

I'm sure there are a few hundred details that I've ommitted here. That's pretty typical in a "one off" project where you just need to get it going and start to run out of time.  And you always run out of time, don't you?  In any case, these are just some pointers - half the fun of doing this is making up your own system.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14125
Re: CHDKPTP based Photoboot
« Reply #5 on: 06 / February / 2016, 14:48:43 »
Code: [Select]
!cli:execute("rs")but didn't work :(
Can you explain what happened when "didn't work"?

Note that gui.execquick be default doesn't wait for the commands to finish, so if you tried to run rs immediately after that, it would fail.

You can make gui.execquick wait using something like
Code: [Select]
gui.execquick([[
...your code...
]],{wait=true})

Also to execute a CLI command, you should use
Code: [Select]
cli:execute("rs")

without an !
The ! is only used if you are entering local lua in the console.

Quote
How can I associate a button to list of cli commands?
Just use cli:execute() calls for each command.
Don't forget what the H stands for.

Re: CHDKPTP based Photoboot
« Reply #6 on: 09 / February / 2016, 15:55:43 »
thanks to all!!!
Both answer very usefull for me.
Rayleg: my problem was the ! befor cli:execute
waterwingz: veri interesting! I'll do somting simpler(Eg without light management) (i'm a chemist that some times write some litte script and i'm not able to do a complex software like yours!)
I will post my simpler solution, maybe will be usefull for some one else


Re: CHDKPTP based Photoboot
« Reply #7 on: 09 / February / 2016, 22:49:21 »
I will post my simpler solution, maybe will be useful for some one else
Well, from a software stand point,  what I posted was pretty basic.  Had to be - I ran out of time.

On the other hand,  you could just set the camera script to take a picture every three or four seconds until the battery dies or SD card fills.  I believe that would definitely be the simplest solution. 

Somewhere between that and what I wish I had been able to do is a solution that will be perfect for your needs, skills and resources!  By all mean please post it here for others to follow. 

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline axman

  • ***
  • 145
Re: CHDKPTP based Photoboot
« Reply #8 on: 11 / February / 2016, 13:04:59 »
I'm very interested in your project.... please tell me more about it! :)
Here's a quick rundown.  I had bigger plans but as usual, ran out of time. But what I got working was a big success and it ran automatically all night so that I did not have to 'babysit' it.

Waterwingz, your Photobooth project rocks.  Thanks for sharing those details.  Very helpful to me, to see it all at a high level, as well as seeing the critical implementation detail - the c code.  I'll use this to learn.  Thanks.

*

Offline reyalp

  • ******
  • 14125
Re: CHDKPTP based Photoboot
« Reply #9 on: 23 / February / 2016, 21:19:39 »
shallappa asked (in PM) how to start with the live view active.

Adding the following to gui_live.lua m.init makes the viewport and bitmap enabled by default
Code: [Select]
vp_toggle.value="ON"
vp_toggle:action(1)
bm_toggle.value="ON"
bm_toggle:action(1)
If you don't want the bitmap (camera UI) leave out the bm_ lines.

To make the live tab active by default, you can add the following to in the gui.lua main dialog definition (dlg = iup.dialog{...)
Code: [Select]
map_cb=function()
maintabs.VALUEPOS=2
end,

These should really be pref settings in the chdkptp code. Some day, I'll get around to it ;)
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal