/sigma-ptpy

A third-party camera control library for SIGMA fp series.

Primary LanguagePythonMIT LicenseMIT

sigma-ptpy Python package

A third-party camera control library for the SIGMA fp series.

The SIGMA fp series is a set of full-size mirrorless cameras developed by SIGMA Corp. The cameras supports PTP (Picture Transfer Protocol; ISO15740) for access to functionality of them from computers such as

  • getting and setting parameters (shutter speed, aperture, white balance, color mode, etc.),
  • taking pictures,
  • live view,

and so on. This Python library provides a part of the opration on the fp series.

API doc is built by Sphinx, and is available on online.

Getting started

The latest version can be installed by

pip install git+https://github.com/akabe/sigma-ptpy.git

After the installation, connect your SIGMA fp to your computer with "Camera Control" mode and type the following command. If the camera is detected, a message is printed.

$ python examples/get_info.py
CamDataGroup1:
  ShutterSpeed = None (0x0)
  Aperture = None (0x0)
  ISOAuto = ISOAuto.Auto
  ISOSpeed = None (0xf8)
  ExpCompensation = 0.0 (0x0)
  ABValue = 0.0 (0x0)
  ABSetting = ABSetting.AB3ZeroMinusPlus
  FrameBufferState = 9 (shots)
  MediaFreeSpace = 2901 (shots)
  MediaStatus = 1
  CurrentLensFocalLength = 45.0 (mm)
  BatteryState = 8
  ABShotRemainNumber = 0
  ExpCompExcludeAB = 0
CamDataGroup2:
  DriveMode = DriveMode.SingleCapture
  SpecialMode = SpecialMode.LiveView
  ExposureMode = ExposureMode.ProgramAuto
  AEMeteringMode = AEMeteringMode.Null
  FlashMode = FlashMode.Normal
  FlashSetting = FlashSetting.Null
  WhiteBalance = WhiteBalance.Auto
  Resolution = Resolution.High
  ImageQuality = ImageQuality.JPEGFine
CamDataGroup3:
  ColorSpace = ColorSpace.sRGB
  ColorMode = ColorMode.Standard
  LensWideFocalLength = 3840.0
  LensTeleFocalLength = 3840.0
  AFAuxLight = AFAuxLight.OFF
  AFBeep = 5
  TimerSound = 5
  DestToSave = DestToSave.Null

Known bugs

Timeout

When an application program frequently prints the following error, SigmaPTPy(ignore_events=True) reduces errors.

E 5255 ptpy.transports.usb[EvtPolling:__recv:350] [Errno 60] Operation timed out
E 5255 ptpy.transports.usb[EvtPolling:__poll_events:574] <DEVICE ID 1003:c432 on Bus 020 Address 036> polling exception: [Errno 60] Operation timed out

A thread polling PTP events in PTPy possibly fails reading data from SIGMA fp. ignore_events parameter kills the thread in the SigmaPTPy constructor. Timeout will happend only once at the constructor.

Incorrect lens focal lengths

I write a program according to the SIGMA official API document, but LensWideFocalLength and LensTeleFocalLength (in CamDataGroup3) are always wrong in my environment. I have no idea to fix it.

As far as I know, the official document is partially incorrect.

Related work

SIGMA Corp distributes the SIGMA Camera Control SDK for the SIGMA fp series. The official library fully supports the functionality of the cameras, and includes API documents, C/Objective-C headers, and compiled binary files for Windows and Mac.

libgphoto2 is a open-source framework designed to allow access to digital cameras by external programs. It provides operations on a lot of cameras such as Canon, Nikon, and Sony, but SIGMA fp is less supported at the current version v2.5.27.

Contribution

Fork and create a PR, please. Don't forget run python setup.py test and ./git/pre-commit before a PR.