gphoto2 was basically working. However I wanted to take continuous time lapse photographs. It appeard to struggle after 7 frames for some reason. I'm unsure if the camera's resources were running out or the RPi's. I will need to investigate. I was taking dual JPED and RAW images. I manages to "fuse" three JPEG images of different exposures into a single TIFF image. I'm not sure if it was a HDR (16 bit float?) image but the exposure was excelent across the hole image. I need to solve the 7 frame timelapse issue and find a RAW file reader. The workflow I am looking for is somthing like.
gphoto2 => Canon RAW x3 (exposure bracketed)
Canon RAW => ?pfsindcraw? => HDR x3 (exposure bracketed)
HDR x3 (exposure bracketed) => enfuse => HDR x1 (Many 8 stops + dinamic range)
HDR => pfstm => JPEG (Tone mapped)
The idea is to use the RPi to do all this on the fly, hopfully as fast as the time lapse, so that the disk space requirments are very greatly reduced as the three RAW files are converted and deleted as more pictures are taken.
Part 2 So I had some success with bits of the system. I looked at the Photography Projects thread on the raspberry.org site. I found I had to get the small C file as discussed on a linux forum and compile usbreset executable. This built using cc usbreset.c -o usbreset followed by a chmod +x usbreset. I then wrote a bash script that called usbreset /dev/bus/usb/001/00x between calls to gphoto2. I stole the bash script from the Photography Projects thread that automatically worked out where the camera was attached. I found the camera kept moving around when the camerea was swiched on and off but the script could find it reliably.
The key to the discovery of the USB device is...
dev=`gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//'`
I chose to call gphoto2 three times in the script to capture three images. I tried the single command line aproach shown in Photography Projects but I could not get it to work.
I used gphoto2 in --shell mode to discover the settings. Found for the canon 400D i needed to use
Other combinations of command line options did not seam to give reliable results. The thread discusses a Nikon and the use of --set-config-value, I could not get this to work as expected for me.
I used the --filename xyz.jpg and --force-overwrite although I could not get it to work as I expected if the --filename appeared more than one. Therefore used seperate command lines for each photo aquired.
enfuse worked very well. With three small JPG images at three exposures they were combined into a single JPG with superior exposure. However I ran out of memory or TMP scratch space when I tried to produce a HDR image, eg floating point or 32 bit. Having reread the manual it looks like I may be able to set the scratch directory using TMPDIR enviroment variable and also set the cache size and buffer size. There is a table in the manual that is for systems with a lot more memory. I will try a setting in the same perportions scaled to RPi available memory. Note the available memeory will depend on how you have ivided up available memory between CPU and graphics. Raeding the manual it looks like enfuse does a weighted blens so it will reduce noise if given many pictures. enfuse did not do any tone mapping so the output was a suprior exposure but still natural. I played with the pfstools but I think because enfuse generated a LDR JPEG image the results were not very spectacular. The picture were quite ordinary. I need to retry this process and I think I can make improvments.
Raw images were too large to handle and I cause errors. I will stick with small JPG files for now. I may need to revisit RAW images. I think the lack of SD card space may be adding to the problems.
I will try the following workflow.
(gphoto => small jpg ) x 3
(x.jpg x 3) => enfuse => HDR_file.??? x 1 (Format not yet known)
HDR_file.??? => pfsin => pfstmo => frame.jpg.