top bar


Revision as of 13:10, 28 May 2011 by Koen (Talk | contribs)

Summary: Adapter for PTP/MTP cameras
Author: Koen De Vleeschauwer, kdvelectronics
License: LGPL
Platforms: MacOSX, linux
Devices: PTP and MTP cameras connected via USB.
Example Config File: MMConfig_GPhoto.cfg


The GPhoto device driver provides support for cameras through gphoto2. In general these are cameras which connect through USB and use Picture Transfer Protocol (PTP) or Media Transfer Protocol (MTP). See [1] for a list of cameras which support remote capture; this includes most recent Canon and Nikon DSLR models. Cameras marked "Viewfinder" also support remote Live View.


Installation instructions:

  • Download Micro-Manager 1.4.5 or later for Mac OS X. Alternatively, an MacOS X Intel 32-bit only image can be downloaded from Micro-Manager1.4-Gphoto.
  • Connect the camera to the computer with a USB cable.
  • Depending on camera model, you may have to use PTP/MTP mode or normal mode ("USB mass storage"). See if the entry for your camera in the list of camera models says "Normal" or "PTP".
  • On Mac OS X, you have to kill the PTPCamera process to use PTP/MTP mode with micro-manager. Open Applications/Utilities/Activity Monitor, select "PTPCamera" and click on "Quit Process". You will need to kill the PTPCamera process every time you switch the camera on, or connect the camera to the mac.
  • With the camera switched on, start up Micro-Manager.

Add GPhoto to your hardware configuration:

  • Open the Tools menu, and choose Device/Property Browser. If a GPhoto camera is already present, go to "Verify your camera has been detected".
  • Open the Tools menu, and choose Hardware Configuration Wizard.
  • In the "Select the configuration file" window: Click on Next.
  • In the "Add or remove devices" window: Click on Add.
  • In the "Add device" window: Select GPhoto. Click on Add. A small window pops up with "Please type in the new device name". Click on OK. Click on Done.
  • Back in the "Add or remove devices" window: Click on Next.
  • In the "Edit pre-initialisation settings" window: Click on Next.
  • In the "Setup Serial ports" window: Click on Next.
  • In the "Select default devices" window: Choose "GPhoto" as default camera. Click on Next.
  • In the "Set delays for devices without synchronisation capabilities" window: Click on Next.
  • In the "Select devices to synchronize with image acquisition" window: Click on Next.
  • In the "Define position labels for state devices" window: Click on Next.
  • In the "Save configuration" window: Click "Save and test the new configuration". Click on Exit.

Verify your camera has been detected:

  • Open the Tools menu, and choose Device/Property Browser.
  • Verify your camera appears under "GPhoto-CameraName". On systems with more than one camera, you have to manually select the correct camera by clicking on the "GPhoto-CameraName" property value.

You can now use the camera in Micro-Manager.



To access configuration settings, open the "Tools" menu and select "Device/Property Browser". The following settings are available:

Binning groups pixels in both x and y direction. Allowable values are 1, 2, 4, 8.
Specifies the bit depth or dynamic range of the pixel. Actual bit depth may be less, depending upon the camera image sensor. Allowable values are "8" and "16". When set to "16", raw images will be decoded with linear gamma.
Selects which camera is used on systems with more than one camera. Selecting an entry will (re)connect to the camera specified; there is a brief delay while camera settings are read.
Exposure sets the exposure time. Units are ms.
Saves the pictures to disk. Allowable values are 0 and 1. Pictures are stored in the /tmp directory. The pictures are in the format provided by the camera; typically jpeg or raw.
When set to Grayscale, converts images to grayscale. Allowable values are Color and Grayscale.
Allows selecting the shutter speed. If "Shutter speed not set" is selected, micro-manager will not set camera shutter speed. This allows manually setting shutter speed on the camera itself.
When set, shutter speed will change every time the exposure time changes. The shutter speed will change to the setting closest to the exposure time, if possible.
When set, enables TransposeMirrorX, TransposeMirrorY, TransposeXY. Allowable values are 0 and 1. Transposing is useful if the camera image is not oriented as you would expect.
When set, mirrors image horizontally. Allowable values are 0 and 1.
When set, mirrors image vertically. Allowable values are 0 and 1.
When set, rotates image. Allowable values are 0 and 1.


  • If the camera supports remote "Live View", "Live View" is used in live mode. "Live View" produces a low-resolution real-time image. Resolution is typically 640x426 pixels for Nikon, and 768x512 to 1056x704 pixels for Canon DSLR cameras. The exposure time property is used to limit the number of images per second in live mode. E.g. an exposure time of 100ms will result in maximum 10 images per second.
  • On Mac OS X, you have to kill the Apple PTPCamera process every time after connecting your camera, after switching your camera on, and before running micro-manager. If you wish to automate this, try the following:
    • Open Applications/AppleScript/Script Editor.
    • Create a one-line AppleScript
      tell application "PTPCamera" to quit
    • Select File > Save As... and save as "killptpcamera", file format "application".
    • Close Script Editor.
    • Open Applications/Image Capture.
    • Select Preferences... and set "When a camera is connected, open:" to "killptpcamera".
    • Close Image Capture.
    • This causes PTPCamera to quit every time it starts up. To revert to normal behavior, open Image Capture and set "When a camera is connected, open:" to "No application".
  • Many algorithms in Micro-Manager require grayscale images. Feeding a color image to a grayscale-only algorithm typically produces errors such as "Unsupported pixel type" or "Invalid data type". Setting both "PixelType" to "Grayscale" and "KeepOriginals" to "1" will send a grayscale image to Micro-Manager but allow you to read the original color images from disk.
© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact