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 triggeringPtpDataSetLatch
- Linux environment with the Daheng Galaxy SDK installed (headers +
libgxiapi.soin your library path) - C++17-capable compiler (tested with
g++ 11) include/directory from this repo must remain alongsidemain.cpp
g++ main.cpp -Iinclude -o camera_test -lgxiapi -lpthreadAdjust the compiler or library search paths if the Galaxy SDK lives in a non-standard location (e.g. add -L/opt/daheng/lib).
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. |
List connected cameras and view their features without capturing:
./camera_test --list-features --no-capture --no-dump-featuresCapture a frame, create a timestamped feature dump, and keep defaults for everything else:
./camera_testExplicitly place the feature dump in a custom file while skipping the image capture:
./camera_test --dump-features /tmp/my_features.txt --no-captureMonitor 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-featuresfeatures_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-featureson 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|falsevia/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.
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-featuresis supplied; contains every feature value and metadata.
- No cameras detected: confirm the Daheng driver is running (
/dev/hisivpermissions) and that the camera is powered. - Library errors: export
LD_LIBRARY_PATHto include the Galaxy SDKlibdirectory iflibgxiapi.sois not in a default path. - Permission issues when saving files: ensure you have write access to the working directory or use
--output/--dump-featurespaths you control. - PTP fields unreadable: some cameras expose the nodes as write-only or unsupported; the monitor will report "Not readable" for those entries.