Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
<== Date ==> <== Thread ==>

Subject: RE: PTP/MTP/libgphoto2 camera triggering + EPICS?
From: Mark Rivers <rivers@cars.uchicago.edu>
To: "'Gomella, Andrew (NIH/NHLBI) [F]'" <andrew.gomella@nih.gov>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Wed, 9 Oct 2013 15:46:18 +0000
Hi Andrew,

I'm not familiar with any of this, but I did look at the documentation for both the Linux libgphoto2 library and the Windows program digicamControl.  

The libgphoto2 documentation is not very good, it's just Doxygen documentation of structures and files, with no overview or examples of how to use it.  There are source code files for utilities one could study to understand it.

digiCamControl is written in C# and it supports plugins.  This would probably provide a way to control that application from EPICS using the Microsoft Common Language Runtime (CLR).  I have recently done that for the Princeton Instruments LightField application, controlling LightField from an areaDetector driver.

Is it a requirement to control the camera from Windows?

I believe you can also control these cameras with an underlying Windows Image Acquisition (WIA) API.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx


The newer technology appears to be Windows Portable Devices:

http://msdn.microsoft.com/en-us/library/windows/hardware/gg463209.aspx

I think an areaDetector driver could be written using these.

Mark



-----Original Message-----
From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Gomella, Andrew (NIH/NHLBI) [F]
Sent: Tuesday, October 08, 2013 3:10 PM
To: tech-talk@aps.anl.gov
Subject: PTP/MTP/libgphoto2 camera triggering + EPICS? 

Hi Everyone,

I was wondering if anyone had any advice for triggering a USB attached camera which follows the "Picture Transfer Protocol" / PTP (ISO15740) http://en.wikipedia.org/wiki/Picture_Transfer_Protocol which is now also known as "Media Transfer Protocol" with EPICS on windows?

There already is extensive linux support for these cameras in libgphoto2 which works for hundreds of mostly "consumer grade" cameras. http://www.gphoto.org/proj/libgphoto2/support.php There are applications such as "entangle" which allow control of camera settings and also live view feeds of the camera, as well as the command line application gphoto2.

Right now I use an open source application on windows to control the camera. (digicamcontrol http://digicamcontrol.com/)  Here all the hard work is already done because I can control all of the camera's settings, and manually trigger captures as well as view a live stream on windows. However, I would like to make the camera trigger as a PV, such that I can do automated scans in combination with motor stepping etc.

I managed to accomplish this on linux by combining python ptp bindings and code from the out of date pyptp project on google code (pyptp) with pcaspy such that a capture would be triggered when the PV was accessed. However this has proved impossible for me to get to work on windows (after hours of struggling with libusb, pyusb, and the outdated pyptp I realized it was not going to work) I could keep two separate machines and switch the usb cable from the camera whenever I need epics to run a scan, however I believe a more elegant solution exists.

I thought I found the solution when I found that digicamcontrol and another program "controlmynikon" both have built in webservers which allow the camera to be triggered. Then I used pcaspy again to access the URL such that the camera would fire. I realize however that this will not work as EPICS would be completely blind to the cameras busy or not busy status, and thus send capture signals without realizing the camera is busy with a previous capture.

I believe the best solution would be a full epics driver utilizing libgphoto2 and the work already done in the area detector plugin, but my programming expertise is nowhere near where it needs to be to implement this. I did download the areadetector source hoping I could work my way towards simply implementing a PV for firing the camera but was overwhelmed.

Has anyone else ventured into this territory? Anyone using a DSLR or similar camera at their beam-line for scientific/ security/ monitoring reasons? I was surprised a search of tech-talk yielded no results for  "ptp camera" given the number of cameras supported (though they are not "scientific grade" so that may explain it).



Thanks in advance for any help or advice you may have,

Andrew Gomella





References:
PTP/MTP/libgphoto2 camera triggering + EPICS? Gomella, Andrew (NIH/NHLBI) [F]

Navigate by Date:
Prev: FW: Fatal seq_monitor: pvVarMonitorOff Janez Golob
Next: Re: FW: Fatal seq_monitor: pvVarMonitorOff Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
Navigate by Thread:
Prev: PTP/MTP/libgphoto2 camera triggering + EPICS? Gomella, Andrew (NIH/NHLBI) [F]
Next: FW: Fatal seq_monitor: pvVarMonitorOff Janez Golob
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·