Files
PointGreySWIR_legacy/README.md
T

108 lines
5.7 KiB
Markdown

# Point Grey / FLIR SWIR camera on Ubuntu 24.04 / Linux Mint 22
Setup for a legacy **Point Grey Research USB 2.0 camera** (USB vendor `1e10`) on a modern Debian/Ubuntu-family machine. Tested against the camera that reports:
```
idVendor=1e10 idProduct=2005
Product: USB 2.0 Digital Imaging Camera
Manufacturer: Point Grey Research
```
These cameras predate FLIR's Spinnaker SDK and are supported only by the older **FlyCapture2 SDK** (here, version 2.13.3.31). Spinnaker will not see them.
## What gets installed
The FlyCapture2 SDK was built for Ubuntu 18.04. Its GUI applications (`FlyCap2`, `UpdatorGUI`) depend on GTK2-era libraries (`libgtkmm-2.4`, `libglademm-2.4`, `libgtkglextmm`) that no longer exist in Ubuntu 24.04, so we do not install them. The **core** libraries only need `libusb` and `libraw1394`, which are still present, so this setup installs:
- `libflycapture2` / `libflycapture-c2` and their `-dev` packages (C++ and C runtime + headers).
- `FlyCapture2Test` and `FlyCapture2Test_C` — prebuilt command-line tools that list attached cameras and grab test frames. They link only the core library, so they run fine without the GUI stack.
- `fc2view` — a small **live viewer** built from `fc2view.cpp` in this repo, using OpenCV. It replaces the vendor's GTK2 GUI: it streams the first camera into a window and saves snapshots (see below).
- The example source tree at `/usr/src/flycapture/src` for building your own capture programs.
It also does the two bits of host configuration these cameras need:
- **A udev rule + `flirimaging` group** so the camera is readable/writable without root.
- **A larger USBFS buffer** (`usbcore.usbfs_memory_mb=1000`, up from the 16 MB default). Camera frames exceed the default buffer, which otherwise shows up as grab failures or dropped images.
The vendor GUI itself is the only thing lost by not being on 18.04, and `fc2view` covers the common need for a live viewport. If you specifically need the vendor GUI (e.g. for firmware updates via `UpdatorGUI`), run it in an 18.04/20.04 container.
## Live viewer (`fc2view`)
`install.sh` compiles `fc2view.cpp` and installs it as `/usr/local/bin/fc2view`. With the camera plugged in:
```bash
fc2view
```
It connects to the first camera, prints its model and serial, and opens a live window. Keys: **`s`** saves a snapshot to the current directory as `fc2-<serial>-<timestamp>.png` (saved from the raw frame, so a Mono16 SWIR sensor keeps its full bit depth); **`q`** or **Esc** quits. It converts each frame to BGR for display, so it works on mono/SWIR and colour sensors alike.
It's about 130 lines and depends only on OpenCV and the FlyCapture2 core library. Treat it as a starting point for your own acquisition code. Rebuild by hand with:
```bash
g++ fc2view.cpp -I/usr/include/flycapture $(pkg-config --cflags --libs opencv4) -lflycapture -o fc2view
```
## Install
The SDK `.deb` files are bundled under `sdk/` because FLIR's download is behind a login, so the repo is self-contained. From this directory:
```bash
sudo ./install.sh
```
Then **log out and back in** (for the `flirimaging` group to apply). The USBFS limit is set live during install and made permanent on the next reboot; a reboot covers both at once.
Verify, with the camera plugged in:
```bash
FlyCapture2Test # prints camera info + grabs frames
fc2view # opens the live window
```
`FlyCapture2Test` should show the camera's serial, model and firmware, then a batch of grabbed frames. That serial should match the one in `dmesg`/`lsusb` (`00FBA0C0` on the reference machine).
## Rolling out to another machine
The camera model and the OS release are the same across your machines, so:
1. Copy this whole directory (it includes `sdk/` with the `.deb` files).
2. Run `sudo ./install.sh`.
3. Log out and back in (or reboot).
The script is idempotent, so re-running it to repair a machine is safe. If a machine is a **different architecture** (e.g. arm64) or a **different OS release**, the bundled amd64 debs will not apply; get the matching FlyCapture2 build from FLIR and drop its debs into `sdk/`.
## Building your own capture program
Headers are in `/usr/include/flycapture`; the library links with `-lflycapture`. A minimal build:
```bash
g++ my_capture.cpp -I/usr/include/flycapture -lflycapture -o my_capture
```
Or start from a worked example:
```bash
cp -r /usr/src/flycapture/src/FlyCapture2Test ~/fc2test && cd ~/fc2test
g++ FlyCapture2Test.cpp -I/usr/include/flycapture -lflycapture -o FlyCapture2Test
```
## Uninstall
```bash
sudo ./uninstall.sh
```
This removes the libraries, CLI tools, example source and udev rule. It leaves the `flirimaging` group, the GRUB USBFS setting and the apt dependencies in place (they are harmless and may be shared); the script prints how to undo those by hand.
## Troubleshooting
- **`FlyCapture2Test` finds no camera** — confirm `lsusb` shows `1e10:2005`. If it does, you probably have not logged out/in since install, so you lack the `flirimaging` group (`id` should list it). As a one-off check you can run `sudo FlyCapture2Test`.
- **Camera detected but frames fail or time out** — the USBFS buffer did not take. Check `cat /sys/module/usbcore/parameters/usbfs_memory_mb` (should read `1000`); if it reads `16`, reboot so the GRUB setting applies.
- **`error while loading shared libraries: libflycapture.so.2`** — run `sudo ldconfig`.
- **USB 2.0 bandwidth** — this is a USB 2.0 camera (~480 Mbps shared). On a busy hub you may need to lower resolution or frame rate. Plugging it into its own port/controller helps.
## Reference
- Vendor SDK README: `sdk/README`.
- FLIR "Configuring USBFS" note explains the buffer limit (the SDK README links to `ptgrey.com/tan/10685`, now under flir.com support).