Thursday, February 21, 2008

Tethered capture with gphoto2

It turns out that it's fairly easy to use a linux box to
take pictures using my Nikon D50 and display the results
to the screen:



$ gphoto2 --capture-image --interval 10 -F 2 --hook-script showpic.sh

The above takes two frames ten seconds apart (making a D50 into
a very expensive webcam). Alternatively, I could use the following
to use the camera normally but have the pictures show up on the
computer screen:



$ gphoto2 --capture-tethered --hook-script showpic.sh

The "hook script" is what does the actual display after each shot:



$ cat showpic.sh
#! /bin/bash

self=`basename $0`

case "$ACTION" in
init)
echo "$self: INIT"
# exit 1 # non-null exit to make gphoto2 call fail
;;
start)
echo "$self: START"
;;
download)
echo "$self: DOWNLOAD to $ARGUMENT"
eog ${ARGUMENT} &
;;
stop)
echo "$self: STOP"
;;
*)
echo "$self: Unknown action: $ACTION"
;;
esac

exit 0

Pretty darn cool!

No comments:

Post a Comment

Label Cloud