stereo_pyspin
A simple stereo camera library using PySpin.
Installation and User Guide (Spinnaker USB cameras on Linux)
-
Increase USB file system memory. There are two ways:
Permanent way:
-
Open the
/etc/default/grub
file in any text editor. Find and replace:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
with this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.usbfs_memory_mb=1000"
-
Update grub with these settings:
$ sudo update-grub
-
Reboot and test a USB camera.
Temporary way:
-
Run the following command:
sudo sh -c 'echo 1000 > /sys/module/usbcore/parameters/usbfs_memory_mb'
-
-
After doing either the permanent or temporary way, confirm that you have successfully updated the memory limit by running the following command:
cat /sys/module/usbcore/parameters/usbfs_memory_mb
The output should be 1000.
-
Configure udev rules to allow access to USB devices:
cd /tmp wget https://github.com/justinblaber/stereo_pyspin/blob/master/spinnaker-1.10.0.31-amd64.tar.gz?raw=true -O spinnaker-1.10.0.31-amd64.tar.gz tar xvfz spinnaker-1.10.0.31-amd64.tar.gz sudo sh spinnaker-1.10.0.31-amd64/spin-conf
-
Download singularity image:
mkdir -p ~/stereo_pyspin cd ~/stereo_pyspin singularity pull --name stereo_pyspin.img shub://justinblaber/stereo_pyspin
-
Set up acquisition folder and copy YAML configurations for each camera into it:
mkdir -p ~/Desktop/stereo_pyspin_test cd ~/Desktop/stereo_pyspin_test wget https://raw.githubusercontent.com/justinblaber/stereo_pyspin/master/primary.yaml wget https://raw.githubusercontent.com/justinblaber/stereo_pyspin/master/secondary.yaml
Make sure to modify
primary.yaml
andsecondary.yaml
to set the serial numbers and do the appropriate camera initializations. -
Run the singularity image:
singularity run ~/stereo_pyspin/stereo_pyspin.img
A gui should appear like so:
-
Find and initialize both primary and secondary cameras, then start the stream. If successful, the gui should look like:
-
After the stream is started, you can save images:
16276941_2018-07-10_02:04:23_916915_1_L.png
:16276942_2018-07-10_02:04:23_918101_1_R.png
:It's important to note that the images should be acquired very closely in time (especially if a hardware trigger is used).