[BREAKGLASS] Append-only mirror of github.com/sparrowwallet/openpnp-capture
Go to file
Craig Raw 495c0461bb
Some checks failed
/ macos_x86_64 (x86_64, macos-latest) (push) Has been cancelled
/ macos_arm64 (arm64, macos-latest) (push) Has been cancelled
/ windows_x86_64 (x86_64, windows-latest) (push) Has been cancelled
/ linux_arm64 (arm64, ubuntu-20.04) (push) Has been cancelled
/ linux_x86_64 (x86_64, ubuntu-20.04) (push) Has been cancelled
remove manual dealloc calls on objects managed by arc
2025-03-14 09:00:50 +02:00
.github/workflows - Attempt to fix an issue with the test program library version not matching the built library version, and additionally building the wrong library version. Attempting to fix https://github.com/openpnp/openpnp-capture/issues/60 using suggestions from that thread. 2023-04-03 17:58:29 -05:00
cmake Updated project/CMake file to use the current GIT tag as the library version 2017-08-15 17:49:46 +02:00
common ensure all structures are initialized 2025-03-11 10:51:20 +02:00
doc Updated documentation to reflect the availability of exposure control. 2017-07-11 01:26:01 +02:00
docker Remove unnecessary dependencies 2020-04-25 13:48:20 +10:00
include CAPI: Fix missing typedef on public CapFormatInfo struct 2020-08-25 13:19:36 +02:00
linux ensure all structures are initialized 2025-03-11 10:51:20 +02:00
mac remove manual dealloc calls on objects managed by arc 2025-03-14 09:00:50 +02:00
QtCaptureTest Create README.md 2022-03-17 19:19:11 -05:00
win Using CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) to be compatible with Java 17. 2023-05-18 14:30:29 +02:00
.gitignore - Nope, because then artifacts are a pain. So, a job for each arch and os. 2023-02-15 22:34:03 -06:00
bootstrap_linux.sh Started on Linux V4L2 integration 2017-07-12 01:23:49 +02:00
bootstrap_osx.sh Fixed CLANG compile errors. Updated CMakeLists.txt 2017-07-11 17:18:01 +02:00
bootstrap.bat Fixed bug in Win:setProperty() that returns an undefined status code. Updated QtCaptureText to include more camera properties. 2017-10-06 00:46:49 +02:00
CMakeLists.txt Using CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) to be compatible with Java 17. 2023-05-18 14:30:29 +02:00
Doxyfile Updated doxygen project file to have relative paths. Updated documentation of C API functions. Added MIT license to platform independent code files 2017-08-01 12:54:10 +02:00
LICENSE.txt Create LICENSE.txt 2017-07-11 09:41:33 -05:00
README.md Update README.md 2022-03-17 19:00:08 -05:00

OpenPNP Logo

openpnp-capture

OpenPnP Capture is a cross platform video capture library for C with a focus on machine vision. Its goals are:

  • Native camera access on Windows, Linux and Mac. Implemented with DirectShow, V4L2 and AVFoundation respectively.
  • Named device enumeration.
  • Strong, repeatable, unique IDs.
  • Format control with support for at least YUV and MJPEG. Compressed formats such as MJPEG allow the use of multiple USB cameras on a hub or root controller.
  • Auto and manual exposure control.
  • Auto and manual focus control.
  • Simple, common C wrapper for the listed APIs.

Features

Feature Windows macOS Linux
Platform API DirectShow AVFoundation V4L2
Named Device Enumeration Yes Yes Yes
Capturing Yes Yes Yes
MJPEG formats Yes Yes (dmb1) Yes
YUV formats Yes Yes Yes, YUYV/YUV2
Exposure control Yes Yes Yes
Focus control Yes Yes Yes
Zoom control Yes Yes Yes
Gain control Yes Yes Yes
White balance control Yes Yes Yes
Common C API Yes Yes Yes
Framerate control No No No
Re-Enumeration No No No

Getting Started

Packages and binaries are available in releases.

Examples:

  • QtCaptureTest is a cross platform test program for OpenPnP implemented with Qt.
  • openpnp-capture includes simple examples for Mac, Linux, and Windows.

See below for information about Building OpenPnP Capture.

Documentation for openpnp-capture needs improvement. We would love your help!

Building OpenPnP Capture

Dependencies

  • CMAKE 3.1 or better
  • MAKE (osx, linux)
  • Visual Studio 2013 + NMake or Ninja Build (windows)
  • NASM for building libjpeg-turbo (linux)
  • libgtk-3-dev (linux, test program)

Build instructions (Windows)

Run the batch file 'bootstrap.bat' and choose the desired build system (VisualStudio/nmake or Ninja). Make sure the compiler (Visual Studio) is in the search path.

Go to the build directory and run nmake or ninja to build the library and the test application.

Build instructions (OSX)

Run 'bootstrap_osx.sh'. Run make.

Build instructions (Linux)

Run 'bootstrap_linux.sh'. Run make.

Supporting Other Platforms

  • Implement all PlatformXXX classes, like in the win or linux directories.
  • PlatformContext handles device and internal frame buffer format enumeration.
  • PlatformStream is responsible for capturing and decoding the camera stream to a 8-bit per channel RGB frame buffer.
  • Statically link external dependencies.

Releases

Releases are built automatically for new tags on all supported platforms using Github Actions. See https://github.com/openpnp/openpnp-capture/releases/latest to download the latest.

Platform Notes

MacOS

On MacOS as of 10.15 Camera permission is needed to open the camera. The library will automatically execute the permission request, but an Info.plist is required to exist in the application bundle. An example Info.plist is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSCameraUsageDescription</key>
	<string>openpnp-capture needs permission to access the camera to capture images.</string>
</dict>
</plist>

You can reset the camera permissions in MacOS for testing purposes by running tccutil reset Camera.