Skip to content

exordor/DaHengCamera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camera Test Utility

A single-binary helper for working with Daheng Galaxy cameras via the GxIAPI SDK. The tool can:

  • enumerate connected cameras and show serial/model info
  • capture a single frame and store it as Netpbm (.pgm / .ppm) or raw data
  • dump every GenICam feature (name, type, access, current value) to a timestamped text file
  • continuously print any Ptp* nodes by repeatedly triggering PtpDataSetLatch

Requirements

  • Linux environment with the Daheng Galaxy SDK installed (headers + libgxiapi.so in your library path)
  • C++17-capable compiler (tested with g++ 11)
  • include/ directory from this repo must remain alongside main.cpp

Build

g++ main.cpp -Iinclude -o camera_test -lgxiapi -lpthread

Adjust the compiler or library search paths if the Galaxy SDK lives in a non-standard location (e.g. add -L/opt/daheng/lib).

Usage

Run ./camera_test --help for the exact syntax. The most relevant flags are summarized below:

Option Description
--index N Select the Nth detected camera (1-based).
--list-features Print every feature node with type/access info.
--no-capture Skip frame capture (useful when only dumping/monitoring features).
--output NAME Set the base filename for the captured frame (NAME.pgm/.ppm/.raw).
--dump-features FILE Write a full feature dump to FILE.
--no-dump-features Disable feature dump entirely.
--ptp-monitor Enable PTP monitoring (defaults to endless loop every 2 s).
--ptp-monitor-count N Limit the monitor loop to N snapshots.
--ptp-monitor-interval SEC Change the snapshot interval (seconds).
--ptp-json Emit one JSON snapshot of all Ptp* nodes and exit.
--features-json Emit one JSON snapshot describing every feature node and exit.
--set-feature NAME=VALUE Apply a writable feature (e.g. PtpEnable=true) before running other actions.

Common workflows

List connected cameras and view their features without capturing:

./camera_test --list-features --no-capture --no-dump-features

Capture a frame, create a timestamped feature dump, and keep defaults for everything else:

./camera_test

Explicitly place the feature dump in a custom file while skipping the image capture:

./camera_test --dump-features /tmp/my_features.txt --no-capture

Monitor the camera's IEEE-1588/PTP status ten times at 1-second intervals:

./camera_test --ptp-monitor --ptp-monitor-count 10 --ptp-monitor-interval 1 --no-capture --no-dump-features

Realtime web dashboard

features_web.py wraps the binary with a tiny HTTP server that exposes /api/ptp and /api/features, plus a combined dashboard at web/index.html.

./camera_test --help   # make sure the binary is built first
python3 features_web.py 0.0.0.0 8000
# Visit http://localhost:8000/ in your browser
  • The top card polls /api/ptp, which internally runs ./camera_test --ptp-json --no-capture --no-dump-features on each request.
  • The feature explorer calls /api/features (which runs ./camera_test --features-json --no-capture --no-dump-features) and lets you filter/search client-side.
  • The PTP card includes a PTP Enable switch that issues --set-feature PtpEnable=true|false via /api/feature, giving you instant control without leaving the browser.
  • Use the interval input to tune PTP polling, Pause to freeze, and the Refresh features button whenever you need a fresh feature dump.
  • If any API returns an error (e.g., camera disconnected), the banner turns red and shows the stderr snippet for quick diagnosis.

Generated files

  • frame.pgm / frame.ppm / frame.raw — single captured frame depending on pixel format; change the base via --output.
  • features_YYYYMMDD_hhmmss.txt — created automatically unless --no-dump-features is supplied; contains every feature value and metadata.

Troubleshooting

  • No cameras detected: confirm the Daheng driver is running (/dev/hisiv permissions) and that the camera is powered.
  • Library errors: export LD_LIBRARY_PATH to include the Galaxy SDK lib directory if libgxiapi.so is not in a default path.
  • Permission issues when saving files: ensure you have write access to the working directory or use --output/--dump-features paths you control.
  • PTP fields unreadable: some cameras expose the nodes as write-only or unsupported; the monitor will report "Not readable" for those entries.

About

configure daheng camera on linux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors