Documentation for pydc

147 views
Skip to first unread message

Arjun

unread,
Apr 29, 2010, 9:49:13 AM4/29/10
to pydc1394
Hallo,

I am Arjun -- and I'm a user of this rather nifty library. I have just
gotten to terms with a hyperspectral imager, and the pythonic wrapper
allows me to already get frames out of my camera!

So firstly -- thank you very much for this effort. And thanks to Tamas
for giving me a branch tarball to start with.

Subsequently, I am now trying to put the library into active use in my
project -- and I have looked at the examples folder that are in the
launchpad branch (excuse the mail Tamas -- I had not looked at that
branch earlier)

These help me further a little bit -- but I'm wondering if somebody
can pass me a little documentation on the objects and features of the
library?

For example, in the examples file "save_image.py":

cam0.brightness.mode = 'auto'
cam0.exposure.mode = 'auto'
cam0.white_balance.mode = 'auto'

are three lines -- that I cannot guess from the auto-complete features
in a python IDE, because these do not pop up.

So it would be really useful for me to understand the library so far
-- and put it to use. Also, I am willing to contribute some effort to
this project -- help documentation, maybe some coding, or help in
migration to python 3.0 when numpy is upgraded later this year.

So, can anybody help me with some words?

Cheers,
A

Arjun

unread,
Apr 30, 2010, 12:58:45 PM4/30/10
to pydc1394
As an update:

I've managed to access most of the 'features' of the camera -- using
getattr() and setattr() calls. Everything works as expected with the
camera settings -- although it felt for a bit strange to be using
these handles for the cam.features.

If this is how it is meant to be accessed anyhow with pydc1394, then I
guess it obviates the reply to my previous mail. Most of the queries
then get shifted over to the manual of the camera instead.

Thanks again!

Cheers,
Arjun

Tomio

unread,
Apr 30, 2010, 1:34:24 PM4/30/10
to pydc1394
On Apr 30, 12:58 pm, Arjun <arjun.che...@gmail.com> wrote:
> As an update:
>
> I've managed to access most of the 'features' of the camera -- using
> getattr() and setattr() calls.  Everything works as expected with the
> camera settings -- although it felt for a bit strange to be using
> these handles for the cam.features.
>
> If this is how it is meant to be accessed anyhow with pydc1394, then I
> guess it obviates the reply to my previous mail. Most of the queries
> then get shifted over to the manual of the camera instead.
>
> Thanks again!
>
> Cheers,
> Arjun

Hi Arjun,

You do not have to call the getattr(), setattr() functions normally.
If you have a camera set up, let us say:

from pydc1394 import DC1394Library, Camera
lib = DC1394Library()
cam = Camera(lib, lib.cameralist[0]['guid'])

Then:
print cam.features
gives you the list of available features, and:

print cam.shutter.range, cam.shutter.val

should tell you the possible and actual shutter values. (First is a
min, max tuple.)

cam.shutter.val = 100

Should set the shutter value on the camera. This set operation will
call the setter(), and send the data to the camera.
Sometimes the range is (0L,0L), thus no value can be set, then an
error comes up. These properties (such as the temperature) may be only
turned ON or OFF (usually this activates or deactivates the Peltier
cooling of a camera).

I hope this helped to start up a bit.

Tomio

Arjun Chennu

unread,
Apr 30, 2010, 2:04:45 PM4/30/10
to pydc...@googlegroups.com
Hi Tomio,

I guess what I meant to say was that in order to find out what attributes a certain feature has, that is shutter.val, shutter.range, shutter.pos_modes -- one has to use getattr(cam.shutter, <attribute_name>).

Also, in my particular program -- the camera is one device amongst many in an operational platform. The modules are dynamically loaded, and and so the attributes have to be gotten through the getattr() loopup method anyhow. Of course, for my test script it did work as you have indicated.

Questions:
  • So my camera has a property sharpness.range = (0L, 4095L). Does this mean one cannot change this setting? It seemed like I could set sharpness.val as I pleased. I could not really figure out what the "L" meant.
  • There seems to be two ways to get to the fps. cam.fps is one. The other is through the feature 'framerate'. Anyhow, it seems like there is the function get_framerates_for_mode which should probably be used as cam.fps = get_framerates_for_mode()[0] (for first possible framerate). What happens when you set it arbitrarily, like cam.fps = 3.283 (or some number that's not in the framerates list?)

Of course, I don't know much details of where exactly the project stands -- but seems like it is ready for 1.0 release, albeit with a bit more documentation. I didn't try too hard, but it seemed like there weren't too many __doc__ strings in the places where one would expect them.


Feeling the weekend coming,

SirVer

unread,
May 3, 2010, 10:12:09 AM5/3/10
to pydc1394
Hi,

About your questions:

- The L is pythonic for Long. It will be gone in Python 3. You can
savely ignore it and set your sharpness viw
sharpness.val
- One of those twos is not supported by all cameras (I cannot remember
which one, I think fps). most cameras only support some standard fps,
if you can set the properties val to an intermediate value, the camera
should do what you intended.

As far as I see it, every function is documented in a way. The
properties are autogenerated via introspection and are therefore not
documented. A sphinx documentation would be useful and I am not going
to add a preliminary one right now. Also, jordens has a sphinx docu in
his branch which will get merged in a way back to the trunk.

Cheers,
Holger

Tomio

unread,
May 9, 2010, 4:45:51 AM5/9/10
to pydc1394
Framerates: usually the non FORMAT7 modes have fixed frame rates,
while FORMAT7 is the customizable mode. Some cameras are also do their
best in FORMAT7_0 or similar.

Our ORCA from Hamamatsu has the binning modes as FORMAT7_0, FORMAT7_1,
etc. Our higher speed camera can do its best only in FORMAT7_0 mode.
The frame rate function of dc1394 however returns some crappy values
for these modes, which may also come from some deviations of the
cameras from the standard.

So, the standard modes have some standard possible frame rates, while
the speed of the FORMAT7 ones depends on other things, like shutter
speed, binning, ROI.
Reply all
Reply to author
Forward
0 new messages