1

I am working with a Point Grey camera (Grasshopper3) and I analyse the images using OpenCV in Python. Point Grey cameras come with an API in C named flycapture. I found python bindings for the flycapture v2 api on GitHub (pyflycapture2) and they provide installation instructions for Unix systems, but since I'm on Windows, I cannot use the awesome apt-get command.

Here is the instructions provided:

mkdir ~/git
cd ~/git
git clone https://github.com/peterpolidoro/pyflycapture2.git
sudo apt-get install python-pip python-virtualenv -y
mkdir ~/virtualenvs/
virtualenv ~/virtualenvs/flycapture2
source ~/virtualenvs/flycapture2/bin/activate
pip install cython
pip install numpy
cd ~/git/pyflycapture2/
python setup.py install

I don't need to install Cython and NumPy since they are included in my Python distribution (Anaconda)

I tried running only python setup.py install but then I get ImportError: No module named flycapture2 if I test the installation with the code provided in the repository.

Any help would be really appreciated!

toine
  • 1,946
  • 18
  • 24
  • what version of python? – Busturdust Nov 05 '15 at 15:12
  • I'm running python 2.7 – le petit prince Nov 05 '15 at 15:25
  • what command do you use when you get the error message, and from where do you execute it ? – toine Nov 05 '15 at 15:33
  • I'm running the script provided in the distribution `python test_flycapture2.py` which is basically an import followed by printing the informations of the camera plugged in. I tried running it both from the distribution directory and from C:\ and I now get `flycapture2.ApiError: (7, 'Parameter passed to function is invalid.')`. It seems python has finally found the module for some reason! – le petit prince Nov 05 '15 at 15:47
  • 1
    https://github.com/jordens/pyflycapture2/issues/8 seems related to your issue – Busturdust Nov 05 '15 at 15:53
  • 1
    if you are running the script in the `src` directory, python import mechanism will choose the file in current directory as the module to import, instead of the installed module. However, this file is usually not made for such an import. Hence the error. – toine Nov 05 '15 at 16:10

3 Answers3

2

Thanks to Busturdust who pointed out that the issue had already been covered here : https://github.com/jordens/pyflycapture2/issues/8

In summary, new Point Grey cameras don't use the same frame rate format convention then the one used in the module.

0

You should try importing the newly installed module from outside the source directory, and not from where you installed it with python setup.py install. So run your command from your home directory for example.

toine
  • 1,946
  • 18
  • 24
0

If you are running python 3.4, I believe pip should be with the distribution, but I am not sure about anaconda. Try invoking it as python -m pip install [module]

edit: comment appears to have helped solve the issue, adding it to the answer:

"If you have all the dependencies installed, just download the distribution as a zip cleanly, unzip the folder to a temproary location cd to that location and run python setup.py install"

Busturdust
  • 2,447
  • 24
  • 41
  • I think flycapture2 is not available in the pip database : `Could not find a version that satisfies the requirement flycapture2 (from versions: ) No matching distribution found for flycapture2` – le petit prince Nov 05 '15 at 15:34
  • If you have all the dependencies installed, just download the distribution as a zip cleanly, unzip the folder to a temproary location `cd` to that location and run `python setup.py install` – Busturdust Nov 05 '15 at 15:36
  • 1
    That's exactly what I've done. The installation now seems to work (I can import flycapture2) but I get a `flycapture2.ApiError: (7, 'Parameter passed to function is invalid.')` when running a basic program. Thanks for your help! – le petit prince Nov 05 '15 at 15:49