flyCapture SDK (Point Gray CCD camera) in python

Introduction

The flyCapture SDK is a Point Gray SDK for CCD cameras. It officially supports windows and linux, and seems to support C / C ++ / C # as the language. This time, I didn't want to use C ++ because of my personal taste, so I aimed to build an environment in a language other than C ++. Writing first from the results, C # wrestled for about an hour and gave up. python was able to run on ubuntu by using an unofficial library. The following is a memorandum of environment construction.

environment

This time, the camera is connected to the windows computer. As for ubuntu, I prepared it on VMWare because I couldn't use another PC because of the IEEE1394 card. ** However, VMWare cannot handle IEEE1394 connected cameras. ** So, I finally used the Flea3 camera (I should have used another ubuntu PC, but as a result, ubuntu on VMWare could also handle it).

How it failed

The following is the method that failed. I would appreciate it if you could comment.

C Sharp

It should be officially supported by the SDK, so I thought it would be easy to handle, but it didn't work. The installation itself drops .exe and installs it. The problem is that I didn't know which DLL to add to the reference to work. When I added FlyCapture2Managed_v140.dll, the sample code was built, but when I executed it, I got a ??? error like "The dependent dll cannot be loaded". I tried adding it to the PATH and adding it to the reference, but I gave up. Apparently, I can't find much documentation even if I check it with "FlyCapture C #". Can you write it in C ++ obediently? ?? ** But C # should definitely work. Because it should be officially supported. Please let me know ... **

python on Windows

In order, after succeeding in ubuntu, I tried to run it on windows. At that time, it was a fact that I was thinking "Well, can I move with ubuntu?" () First, the SDK does not officially support python. I decided to use the unofficial wrapper library published there. There are several libraries (described later), but the one that seemed to work on windows was pyFly2. The reason is that there is a description for windows in setup.py. So I introduced it according to the README, but I got caught in the error `ʻerror: Unable to find vcvarsall.bat. This is an error that occurs in a library that needs to be compiled, regardless of flyCapture. So I put VC ++ 9.0and tried various things, but I gave up on the error ValueError: [u’path ’] ``. This problem will come up a lot if you look it up, so it seems that you can solve it if you do your best, but it is useless to spend time here because it is another step ahead whether the library works even if it can be compiled (tell yourself) I did).

python on Ubuntu (successful method)

This is the method I adopted. We have introduced a wrapper library for python on ubuntu. I've just run / read the sample, but it seems easy to handle.

Wrapper library

As soon as you google with "python flyCapture" you will find the following two libraries.

  1. jordens/pyflycapture2
  2. kbrafford/pyfly2

I tried pyflycapture2 first, but where to transfer the camera settings in the sample code? I got an error. I wasn't sure, but pyfly2 worked well, so I decided to use it for the time being.

Installation procedure

Introducing SDK

Basically, it is easy if you follow the Installation procedure. The points to note are as follows.

For specific details about using FlyCapture and Linux with a USB 3.0 camera, see TAN2012007 Using Linux with USB 3.0.

It is written to change the USB buffer size? From 2MB to 1000MB, but if you try to capture with a setting exceeding a certain resolution (transfer data size) without doing this, the program will terminate abnormally. I struggled without noticing this (although it was written at the very beginning of the page ...) Probably there is no problem with an IEEE1394 camera (but I have not tried it due to the above circumstances)

If you can capture properly with $ flycap, it is successful. By the way, I was able to capture properly even with a USB device mounted (?) With VMWare.

Introduction of pyfly2

Installation on ubuntu worked if I cloned it with git and followed the README. By the way, it seems that the SDK path described in setup.py does not need to be modified if it is inserted normally. Also, did the DLL copy make sense? It seems that it was working without doing it ...?

in conclusion

I read a little sample of pyfly2, but it feels like I want `ʻexample_opencv_integration.py`` in Don Pisha. If you can get it with numpy, you can do anything else. Another problem is how to change settings and synchronize. I'm curious about how much pyfly2 wraps the API (wraps all C APIs ??) ...

[Addition] Try using it

It was possible to set parameters such as gain, but there is a problem with setting the resolution (and probably the frame rate). It is specified by enum type, but the maximum resolution is _1600x1200Y16. I am currently using a flea3 series camera with a maximum resolution of 2000x2000 or higher, so I cannot specify it. I wish there was a method that could be specified directly as a number ... Probably the SDK version at the time of wrapper development is old and I feel that I can handle it if I change it a little, but I have the energy to do my best ... Well, I think that there are not many situations where it is necessary to dynamically change the resolution. I wonder if I should change it from the official sample application.

Recommended Posts

flyCapture SDK (Point Gray CCD camera) in python
Show decimal point in Python
Load the remote Python SDK in IntelliJ
Calculation result after the decimal point in Python
Quadtree in Python --2
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
SendKeys in Python
Epoch in Python
Discord in Python
Sudoku in Python
DCI in Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
Display n digits after the decimal point in python
[AWS IoT] Register things in AWS IoT using the AWS IoT Python SDK
How to convert floating point numbers to binary numbers in Python
Read and write single precision floating point in Python
A addictive point in "Bayesian inference experience with Python"
AWS SDK for Python (Boto3) development in Visual Studio 2017