Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
caab8f1
Fixed issue #40
maartenvds Feb 6, 2020
45c1d8d
Undo #40
maartenvds Feb 6, 2020
c2d68ea
Add support for streaming to v4l2
Bostwickenator May 2, 2020
922e435
fix failure to compile on later opencv versions
crabdancing Aug 3, 2020
2e33950
Update README.md
Bostwickenator Aug 9, 2020
c4d4b3a
Merge pull request #42 from Bostwickenator/master
Bostwickenator Aug 9, 2020
fe47b80
Merge branch 'master' into patch-1
Bostwickenator Aug 9, 2020
32205b6
Merge pull request #46 from alxpettit/patch-1
Bostwickenator Aug 9, 2020
a414529
Setup GitHub actions to validate the build (#48)
Bostwickenator Aug 26, 2020
f3e2038
Update README.md
Bostwickenator Aug 26, 2020
a4d1cb8
Better support and documentation for Windows (#43)
joshdoe Aug 29, 2020
b6de14d
Add fullscreen toggle and exit on window close (#49)
Bostwickenator Aug 29, 2020
1ec2ad7
Update seek_viewer.cpp
Bostwickenator Aug 29, 2020
e0e3176
Remove usage of boost (#50)
Bostwickenator Aug 30, 2020
fa51e26
request size max
Bostwickenator Sep 5, 2020
7e911e2
Use outframe so we get scale and orientation (#51)
Bostwickenator Sep 5, 2020
ff1d1c9
Reduce timeout now that it isn't fatal.
Bostwickenator Sep 6, 2020
484fa13
Merge pull request #52 from Bostwickenator/libusb_request_size
crabdancing Sep 11, 2020
c7f1fc8
Fix warning (wrong initialization order) (#53)
ebachard Sep 22, 2020
f730845
Update README.md
Bostwickenator Sep 25, 2020
23d7ca0
Update README.md
Bostwickenator Sep 25, 2020
35ec915
Update README.md
Bostwickenator Dec 30, 2020
c00581e
Update FindLibUSB to make it slightly clearer what it is missing if i…
Bostwickenator Dec 30, 2020
2fe3482
Still image capture utility, update OpenCV colormap info (#60)
Bostwickenator Dec 30, 2020
ae8f199
Close seekdevice when the seekcam is closed
Bostwickenator Jan 2, 2021
7b1915c
Merge pull request #61 from Bostwickenator/close_device
Bostwickenator Jan 2, 2021
d4ddcc3
AEL
Bostwickenator Jan 3, 2021
8c5e1c1
SIGQUIT doesn't exist on windows, SIGBREAK not on linux. Use SIGINT
Bostwickenator Jan 3, 2021
c9e09dc
Merge pull request #62 from Bostwickenator/auto_exposure_lock
Bostwickenator Jan 3, 2021
948d749
Merge pull request #1 from NanoExplorer/opencv4_pi
NanoExplorer Jun 10, 2022
cc79e14
added some of the improvements from the framebuffer code to the regul…
NanoExplorer Jun 10, 2022
9ebde9b
added obs presets
NanoExplorer Nov 21, 2022
131c964
supplemental documentation
NanoExplorer Nov 21, 2022
a0f037a
Improved setup instructions with better Udev rules
NanoExplorer Jun 12, 2023
82b9348
Added and changed some debugging statements
NanoExplorer Jun 12, 2023
df9402a
update documentation
NanoExplorer Jun 12, 2023
1397b02
mac compatibility
NanoExplorer Jun 15, 2023
a506243
more mac compatibility
NanoExplorer Jun 15, 2023
27a7259
Merge mac compatibility, upstream, and opencv4
NanoExplorer Jun 15, 2023
33b77e9
Documentation update
NanoExplorer Jun 28, 2023
a296006
Fix auto exposure lock
NanoExplorer Jun 28, 2023
4a2e582
Added optional logic for saving individual raw frames to file, useful…
NanoExplorer Jun 28, 2023
7d6fb91
OBS scene now includes descriptive text
NanoExplorer Jun 28, 2023
a0db26a
Seek Viewer now sends the next frame request immediately. Even 1 ms d…
NanoExplorer May 4, 2025
cd4ef83
Code to debug timing
NanoExplorer May 6, 2025
24a8fbf
Use opencv features instead of doing things manually
NanoExplorer May 7, 2025
b3bb760
Merge branch 'opencv4_pi'
NanoExplorer May 7, 2025
e7e9b43
Fix bug with new frame request system. disable logging
NanoExplorer May 7, 2025
f75c2b0
fix bug with framebuffer flat field system and new request scheme
NanoExplorer May 7, 2025
1a14310
kludge in a workaround for the corrupted frame issue I'm having
NanoExplorer May 28, 2026
e664d92
comment out a lot of timing debugging, add some comments
NanoExplorer May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CMake
on:
push:
workflow_dispatch:
pull_request:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
cmake -E make_directory ${{runner.workspace}}/build
sudo apt-get install libopencv-dev libusb-1.0-0-dev

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE

- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C $BUILD_TYPE
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ tags
*.o
*.a
*.so
.vs/
out/**
CMakeSettings.json
macbuild
pixelmathA.c
seek.py
test_frames
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ addons:
packages:
- libopencv-dev
- libusb-1.0-0-dev
- libboost-program-options-dev

script:
- mkdir -p build
Expand Down
21 changes: 19 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(libseek-thermal)
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.5)

# Request C++11 standard, using new CMake variables.
set (CMAKE_CXX_STANDARD 11)
Expand All @@ -12,15 +12,32 @@ set (WITH_ADDRESS_SANITIZER false CACHE BOOL "Enable address sanitizer")
set (WITH_DEBUG_VERBOSITY false CACHE BOOL "Enable verbose stdout messages")
set (default_build_type "Release")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
endif ()

if (WITH_DEBUG_VERBOSITY)
add_definitions(-DSEEK_DEBUG)
endif ()

message (STATUS "Build type: ${CMAKE_BUILD_TYPE}")

include (MacroLogFeature)

find_package (LibUSB)
macro_log_feature (LIBUSB_FOUND "libusb" "Required to communicate via USB" "https://libusb.info/" TRUE)

find_package (OpenCV REQUIRED)
macro_log_feature (OPENCV_FOUND "OpenCV" "Required to handle image processing" "https://opencv.org/" TRUE)

if (MSVC)
include_directories (${PROJECT_SOURCE_DIR}/win)
endif ()


add_subdirectory (src)
add_subdirectory (examples)

macro_display_feature_log()
Binary file added IR camera demo.docx
Binary file not shown.
74 changes: 47 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# libseek-thermal

[![Build Status](https://travis-ci.org/maartenvds/libseek-thermal.svg?branch=master)](https://travis-ci.org/maartenvds/libseek-thermal) master

[![Build Status](https://travis-ci.org/maartenvds/libseek-thermal.svg?branch=development)](https://travis-ci.org/maartenvds/libseek-thermal) development
![CMake](https://github.com/OpenThermal/libseek-thermal/workflows/CMake/badge.svg?branch=master)

## Description

Expand Down Expand Up @@ -33,15 +31,14 @@ Dependencies:
* cmake
* libopencv-dev (>= 2.4)
* libusb-1.0-0-dev
* libboost-program-options-dev

NOTE: you can just 'apt-get install' all libs above

```
cd libseek-thermal
mkdir build
cd build
cmake ../
cmake ..
make
```

Expand All @@ -58,34 +55,51 @@ For more build options (debug/release, install prefix, opencv install dir, addre
cmake-gui ../
```

## Getting USB access
### Windows

You need to add a udev rule to be able to run the program as non root user:
This library and example programs can be built on Windows with multiple versions of Microsoft Visual Studio. This is most readily done with Visual Studio 2015 or newer, as dependancy binaries for Windows are available from the official projects, as described below.

Udev rule:
libusb is required, and Windows binaries are available from the [offical libusb project](https://libusb.info/).
* Download the latest binary release (files ending in `.7z`) from [libusb GitHub Releases](https://github.com/libusb/libusb/releases)
* Extract the archive
* If using libusb-1.0.24 or greater you will need to copy the contents (`MS64` & `MS32`) of the `VS201X` directory approriate for your version of visual studio up into the root `libusb-1.0.X` directory.
* Set `LIBUSB_DIR` to the extracted directory (e.g., `C:\local\libusb-1.0.23`)

```
SUBSYSTEM=="usb", ATTRS{idVendor}=="289d", ATTRS{idProduct}=="XXXX", MODE="0666", GROUP="users"
```
OpenCV is required, and Windows binaries are available from the [official OpenCV project](https://opencv.org/).
* Download one of the Windows releases from the [OpenCV releases page](https://opencv.org/releases/) (3.x and 4.x work)
* Run the self-extracting archive
* Set `OpenCV_DIR` to the build directory containing `OpenCVConfig.cmake` (e.g., `C:\local\opencv-3.4.10\build`)

Consider setting the `CMAKE_INSTALL_PREFIX` to a location in your build directory. Then after running the INSTALL target, copy the libusb and OpenCV libraries (e.g., `libusb-1.0.dll` and `opencv_world430.dll`) to the `bin\` directory containing `seek_test.exe`.

Before this library or example programs will work, you will need to set the driver for the USB device. The simplest way to do this is to use [Zadig](https://zadig.akeo.ie/). Run Zadig, then select `iAP Interface`, select `libusb-win32`, then click `Install Driver`.

## Configuring USB access

Replace 'XXXX' with:
* 0010: Seek Thermal Compact/CompactXR
* 0011: Seek Thermal CompactPRO

or manually chmod the device file after plugging the usb cable:
You need to add a udev rule to be able to run the program as non root user, and another rule to prevent the kernel from putting the device to sleep. (If the camera is put to sleep, running any utility will fail with `Error: control transfer failed: LIBUSB_ERROR_PIPE` and you will be forced to unplug the camera and plug it back in again.)

Udev rules:

```
sudo chmod 666 /dev/bus/usb/00x/00x
SUBSYSTEM=="usb", ATTRS{idVendor}=="289d", ATTRS{idProduct}=="0010", MODE="0666", GROUP="users"
SUBSYSTEM=="usb", ATTRS{idVendor}=="289d", ATTRS{idProduct}=="0010", TEST=="power/control", ATTR{power/control}:="on"

SUBSYSTEM=="usb", ATTRS{idVendor}=="289d", ATTRS{idProduct}=="0011", MODE="0666", GROUP="users"
SUBSYSTEM=="usb", ATTRS{idVendor}=="289d", ATTRS{idProduct}=="0011", TEST=="power/control", ATTR{power/control}:="on"
```

with '00x' the usb bus found with the lsusb command
Put the above in `/etc/udev/rules.d/90-seekcam.rules`.

The lines with `MODE=` set the device to be readable and writable by everyone, and the lines with `power/control` prevent sleep. `idProduct==0011` corresponds to the Seek Pro and `idProduct==0010` applies to the Seek Compact and Seek Compact XR.

## Running example binaries

```
./examples/seek_test # Minimal Thermal Compact/CompactXR example
./examples/seek_test_pro # Minimal Thermal CompactPRO example
./examples/seek_viewer # Example with more features supporting all cameras, run with --help for command line options
./examples/seek_snapshot # Takes still images, run with --help for command line options
```

Or if you installed the library you can run from any location:
Expand All @@ -96,13 +110,19 @@ seek_test_pro
seek_viewer
```

Some example command lines:
### seek_viewer
seek_viewer is bare bones UI for the seek thermal devices. It can display video on screen, record it to a file, or stream it to a v4l2 loopback device for integration with image processing pipelines. It supports image rotation, scaling, and color mapping using any of the OpenCV color maps. While running `f` will set the display output full screen and `s` will freezeframe.

```
seek_viewer --camtype=seekpro --colormap=11 --rotate=0 # view color mapped thermal video
seek_viewer --camtype=seekpro --colormap=11 --rotate=0 --output=seek.avi # record color mapped thermal video
seek_viewer --camtype=seekpro --colormap=11 --rotate=0 # view color mapped thermal video
seek_viewer --camtype=seekpro --colormap=11 --mode=file --output=seek.avi # record color mapped thermal video
seek_viewer --camtype=seekpro --colormap=11 --mode=v4l2 --output=/dev/video0 # stream the thermal video to v4l2 device
```

### seek_snapshot
seek_snapshot takes still images. This is useful for intergrating into shell scripts. It supports rotation and color mapping in the same manner as seek_viewer. Run with --help for all options.


## Linking the library to another program

After you installed the library you can compile your own programs/libs with:
Expand Down Expand Up @@ -131,23 +151,23 @@ Procedure:
2) Run:
```
# when using the Seek Thermal compact
seek_create_flat_field -c seek seek_ffc.png
seek_create_flat_field -tseek

# When using the Seek Thermal compact pro
seek_create_flat_field -c seekpro seekpro_ffc.png
seek_create_flat_field -tseekpro
```
The program will run for a few seconds and produces a .png file.
The program will run for a few seconds and produces a flat_field.png file.

3) Provide the produced .png file to one of the test programs:

```
# when using the Seek Thermal compact
seek_test seek_ffc.png
seek_viewer -t seek -F seek_ffc.png
seek_test flat_field.png
seek_viewer -t seek -F flat_field.png

# When using the Seek Thermal compact pro
seek_test_pro seekpro_ffc.png
seek_viewer -t seekpro -F seekpro_ffc.png
seek_test_pro flat_field.png
seek_viewer -t seekpro -F flat_field.png
```
## Framebuffer Implementation
In order to run this program from a raspberry pi zero connected to a small 2.2" 320x240 screen, I have implemented a framebuffer
Expand Down
Loading
Loading