CHDK

From XPUB & Lens-Based wiki

Canon Hack Development Kit http://chdk.wikia.com/wiki/CHDK

CHDK is a unique software application developed by enthusiasts that enables extra features for ported Canon™ "Point&Shoot" cameras. (Note: it will not run on DSLR cameras.)

What can it do?

CHDK enhances the capabilities of your camera in a non-destructive, non-permanent way.

More info in http://chdk.wikia.com/wiki/CHDK_User_Manual

Picture Transfer Protocol: PTP

http://chdk.wikia.com/wiki/PTP_Extension

The Picture Transfer Protocol (PTP) facilitates remote operations on a camera connected computer. Typical operations are uploading/downloading photos and remote captures.

The PTP extension for CHDK does not alter the standard operations but adds new CHDK-specific operations instead

PTP client programs

See extensive list in http://chdk.wikia.com/wiki/PTP_Extension#Client_applications

I will give a shot at chdkptp: a client created specifically for controlling CHDK cameras. It provides CLI and optional GUI based on IUP. Also provides a Lua API for the CHDK protocol on the PC. Because the GUI and CLI are also implemented in Lua, this makes chdkptp easy to extend and enables end users to implement complex interactions with code on the camera.

Install instructions - there is a binary for Raspian



gphoto2

Auto detect: to find which usb port is being used

$ gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Canon PowerShot G10            usb:001,013     

Which means that our camera will be located in --port usb:001,013

gphoto2 --port usb:001,013


usage

Usage: gphoto2 [-?valLnPTDR] [-?|--help] [--usage] [--debug]
        [--debug-logfile=FILENAME] [--quiet] [--hook-script=FILENAME]
        [--stdout] [--stdout-size] [--auto-detect] [--show-exif=STRING]
        [--show-info=STRING] [--summary] [--manual] [--about]
        [--storage-info] [--shell] [-v|--version] [--list-cameras]
        [--list-ports] [-a|--abilities] [--port=FILENAME] [--speed=SPEED]
        [--camera=MODEL] [--usbid=USBIDs] [--config] [--list-config]
        [--list-all-config] [--get-config=STRING] [--set-config=STRING]
        [--set-config-index=STRING] [--set-config-value=STRING] [--reset]
        [--keep] [--no-keep] [--wait-event=COUNT]
        [--wait-event-and-download=COUNT] [--capture-preview]
        [-B|--bulb=SECONDS] [-F|--frames=COUNT] [-I|--interval=SECONDS]
        [--reset-interval] [--capture-image] [--trigger-capture]
        [--capture-image-and-download] [--capture-movie=COUNT or SECONDS]
        [--capture-sound] [--capture-tethered=COUNT] [--trigger-capture]
        [-l|--list-folders] [-L|--list-files] [-m|--mkdir=DIRNAME]
        [-r|--rmdir=DIRNAME] [-n|--num-files] [-p|--get-file=RANGE]
        [-P|--get-all-files] [-t|--get-thumbnail=RANGE]
        [-T|--get-all-thumbnails] [--get-metadata=RANGE] [--get-all-metadata]
        [--upload-metadata=STRING] [--get-raw-data=RANGE]
        [--get-all-raw-data] [--get-audio-data=RANGE] [--get-all-audio-data]
        [-d|--delete-file=RANGE] [-D|--delete-all-files]
        [-u|--upload-file=FILENAME] [--filename=FILENAME_PATTERN]
        [-f|--folder=FOLDER] [-R|--recurse] [--no-recurse] [--new]
        [--force-overwrite] [--skip-existing]

Time lapse

$ while true; do d=`date +"%d-%m-%Y_%H:%M:%S"`; echo $d; gphoto2 --port usb:001,013 --capture-image-and-download --filename camera_01/$d.JPG; sleep 0.5; done

Preview

on Pi: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=80611

with mplayer:

gphoto2 --capture-movie --stdout  | mplayer -demuxer lavf -


Python: piggyphoto

Piggyphoto is a simple Python language binding for controlling photo cameras using libgphoto2 that allows one to easily take and download photos with a PTP supporting camera connected to a USB port of the computer.

Install (debian/ubuntu/raspbian)

sudo aptitude install python-piggyphoto
import piggyphoto

C = piggyphoto.camera()
print C.abilities
C.capture_preview('preview.jpg')
C.capture_image('image.jpg')

However I haven't found a way to select one of two camera connected to the host machine.

experimenting with Canon G10

  • model: Canon PowerShot G10
  • firmware version: 100h

How to find fw version

importing one image from the SD-Card to Acid

How to: download

Got to Supported Cameras page, find your camera model and in in the camera model page you will find the CHDK versions available for your camera.

Visit http://mighty-hoernsche.de/ to download the FW. Look at booth what is available for you model and FW version.


camera page and look at the http://mighty-hoernsche.de/


SN: 824FC062106E4F9EA7DCF14BB64E7E9C