Commit Graph

628 Commits

Author SHA1 Message Date
yair
ddb30e00e1 deprcat rollingsum filter 2025-11-22 12:08:49 +02:00
yair
89f904cd71 align with linescan example defaults 2025-11-22 09:55:33 +02:00
yair
a81587e8c6 slow and debug works 2025-11-22 09:52:45 +02:00
yair
d2c1030354 wteak settings 2025-11-21 17:46:53 +02:00
yair
45fa4c07b4 Add brightness-deadband property to intervalometer to prevent oscillation
- Add new brightness-deadband property (default 10.0, range 0.0-50.0)
- Implements deadband/tolerance zone around target brightness
- When brightness is within ±deadband, no adjustments are made
- Prevents oscillation at fast update rates (10-100ms)
- Allows fast corrections when brightness significantly deviates
- Enables fast ramp rates without flicker/oscillation
- Updated README with detailed deadband documentation and usage examples
- Solves exposure fluctuation issue at high frame rates with fast updates
2025-11-21 13:46:19 +02:00
yair
93d8da45e6 rem prints 2025-11-21 13:40:29 +02:00
yair
312972d0c6 bump gain to 65 2025-11-19 18:02:34 +02:00
yair
3046527493 better error on control 2025-11-19 18:02:00 +02:00
yair
732f913a90 ommit print 2025-11-18 20:35:24 +02:00
yair
5c91899669 ommit print 2025-11-18 20:35:15 +02:00
yair
a7a776fb58 feat: adapt linescan scripts to use uv and proper rollover-based file saving
- Updated launch_with_signal.py with PEP 723 metadata for uv compatibility
- Added day/night mode presets with command-line arguments
- Implemented proper rollover-only file saving via Python/PIL callbacks
- Removed multifilesink from pipeline (was saving every frame incorrectly)
- Added funny auto-generated output directory names (e.g., fuzzy-photon)
- Updated rollover_example.py to follow same pattern with uv support
- Updated rollover_example.c to demonstrate signal detection without file saving
- Updated launch_with_capture.ps1 to remove incorrect multifilesink usage
- All scripts now save files ONLY on rollover events, not every frame
- Pipeline simplified: camera -> linescan -> display (files saved in callback)
2025-11-18 19:39:51 +02:00
yair
f5202203af launcher 2025-11-18 19:03:42 +02:00
yair
6686cb4534 fit 2025-11-18 01:12:52 +02:00
yair
b19babd038 Add linescan plugin for line scan camera simulation
- New plugin extracts single row/column from frames and builds line scan image
- Supports horizontal mode (extract row, stack vertically)
- Supports vertical mode (extract column, stack horizontally)
- Configurable line index and output size
- Proper caps negotiation with fixate_caps implementation
- Updated build system to include linescan plugin
- Added comprehensive README with usage examples
2025-11-18 01:10:47 +02:00
yair
07673f3f36 renamed 4pix crop ini file 2025-11-17 14:21:43 +02:00
yair
42da258e8b renamed 4pix crop ini file 2025-11-17 14:21:34 +02:00
yair
a4b49c54b6 Add brightness temporal smoothing to reduce oscillation from moving objects
- Added brightness-smoothing parameter (0-1, default 0.1)
- Implements exponential moving average to filter transient brightness changes
- Samples brightness every frame but smooths before adjusting exposure
- Reduces oscillation from people/cars/birds moving through scene
- Updated DEBUG.md with complete implementation details

Recommended settings for dawn/dusk time-lapse:
  ramp-rate=vslow update-interval=1000 brightness-smoothing=0.1
2025-11-17 13:58:02 +02:00
yair
2281d8a5ac Add brightness temporal smoothing to reduce oscillation from moving objects
- Added brightness-smoothing parameter (0-1, default 0.1)
- Implements exponential moving average to filter transient brightness changes
- Samples brightness every frame but smooths before adjusting exposure
- Reduces oscillation from people/cars/birds moving through scene
- Updated DEBUG.md with complete implementation details

Recommended settings for dawn/dusk time-lapse:
  ramp-rate=vslow update-interval=1000 brightness-smoothing=0.1
2025-11-17 13:57:55 +02:00
yair
9330477e16 Fix intervalometer flickering: implement proper ramping + IDS SDK exposure query
- Fixed instant exposure jumps causing visible flickering
- Implemented proper gradual ramping using ramp_step variable
- Added IDS uEye SDK integration for accurate exposure range query
- Added hcam property to idsueyesrc to expose camera handle
- Updated intervalometer to query on first frame when camera is ready
- Added comprehensive debug documentation with tuning guide

For dawn/dusk time-lapse, use:
  ramp-rate=vslow update-interval=1000
2025-11-17 13:48:02 +02:00
yair
448e9bc5b4 ignore csv 2025-11-17 12:43:07 +02:00
yair
934de5753b intervalometer: Remove hardcoded limits and add rate limiting
- Remove hardcoded exposure (0.85/1.24ms) and gain (0/52) limits
- Add automatic querying of camera capabilities on startup
- Query current exposure/gain settings from camera on reset
- Add update-interval property for rate limiting (default 100ms)
- Prevent algorithm from running at full framerate (750fps)
- Expand property ranges to support any camera capabilities
- Algorithm now fully automated and adapts to camera limits
2025-11-17 12:38:56 +02:00
yair
73fbbaa9fd Fix intervalometer ramp-rate enum property registration
Fixed GLib-GObject-CRITICAL errors caused by incorrect enum type
registration in the intervalometer plugin.

The issue was on line 189 where g_param_spec_enum() was being called
with GST_TYPE_INTERVALOMETER (the class type) instead of a proper
enum GType for the ramp-rate property.

Changes:
- Added gst_intervalometer_ramp_rate_get_type() function to properly
  register the GstIntervalometerRampRate enum as a GType
- Defined GST_TYPE_INTERVALOMETER_RAMP_RATE macro
- Updated PROP_RAMP_RATE property installation to use the correct
  enum type

This fixes the following errors that appeared during pipeline launch:
- g_param_spec_enum: assertion 'G_TYPE_IS_ENUM (enum_type)' failed
- validate_pspec_to_install: assertion 'G_IS_PARAM_SPEC (pspec)' failed
- g_param_spec_ref_sink: assertion 'G_IS_PARAM_SPEC (pspec)' failed
- g_param_spec_unref: assertion 'G_IS_PARAM_SPEC (pspec)' failed
2025-11-17 01:19:09 +02:00
yair
b11cd27d14 Add intervalometer filter for automatic exposure control
Implements YASS-inspired automatic exposure control for IDS uEye cameras.
The intervalometer filter analyzes video brightness in real-time and
smoothly ramps camera exposure and gain settings during changing light
conditions - ideal for sunset/sunrise time-lapse photography.

Key features:
- Automatic exposure ramping (0.85-1.24ms configurable range)
- Automatic gain control (0-52 configurable range)
- Real-time brightness analysis (GRAY8, GRAY16, RGB, BGR, BGRA)
- YASS-inspired ramping algorithm (exposure priority, then gain)
- Configurable ramp rates (VSlow/Slow/Medium/Fast/VFast)
- Exposure compensation (±4 stops)
- CSV logging of exposure parameters
- Direct GObject property control (no message bus overhead)

Technical implementation:
- GstBaseTransform filter for in-place processing
- Discovers upstream camera element by name
- Controls camera via g_object_set() for synchronous updates
- Frame-by-frame brightness calculation with format support

Files added:
- gst/intervalometer/gstintervalometer.c: Main implementation (734 lines)
- gst/intervalometer/gstintervalometer.h: Header with structure definitions
- gst/intervalometer/CMakeLists.txt: Build configuration
- gst/intervalometer/README.md: Comprehensive documentation

Files modified:
- gst/CMakeLists.txt: Added intervalometer subdirectory
- build.ps1: Added intervalometer to build and deployment pipeline

Usage example:
  gst-launch-1.0 idsueyesrc name=cam ! \\
    intervalometer enabled=true camera-element=cam \\
      exposure-min=0.85 exposure-max=1.24 \\
      gain-min=0 gain-max=52 ramp-rate=medium ! \\
    autovideosink

Inspired by YASS (Yet Another Sunset Script) for CHDK cameras by
waterwingz, based on work by Fbonomi and soulf2.
2025-11-17 01:05:16 +02:00
yair
5fb24cb294 Remove all camera systems except IDS uEye from sys folder
- Deleted all subdirectories from sys/ except idsueye/
- Updated sys/CMakeLists.txt to only include idsueye subdirectory
- Updated main CMakeLists.txt to only search for IDSuEye package
- Removed find_package() calls for: Bitflow, NIIMAQ, NIIMAQdx, FreeImage,
  OpenCV, Aptina, EDT, Euresys, GigESim, Imperx, ImperxSDI, IOtechDaqX,
  KAYA, Matrox, Phoenix, Pleora, Pylon, QCam, Sapera, and XCLIB

The project now exclusively supports IDS uEye cameras in the sys folder.
2025-11-17 00:36:49 +02:00
yair
30e695f961 Add YASS (Yet Another Sunset Script) v4.8 for CHDK cameras
This commit introduces third-party work by waterwingz, based on scripts
by Fbonomi and soulf2. YASS is an advanced intervalometer script for
CHDK-enabled Canon cameras that automatically adjusts exposure settings
during sunset, sunrise, or other changing light conditions.

Key features:
- Automatic exposure ramping (shutter speed and ISO)
- Intelligent ND filter control
- Focus lock options (AFL/MF at infinity)
- Configurable shot intervals and exposure compensation
- CSV logging of exposure parameters
- Battery-saving display blanking options

Original work released under GPL license.
Requires CHDK 1.2.0 build 3276 or higher (1.3.0+ recommended).

Files added:
- yass/yass4.lua: Main script (v4.8)
- yass/README.md: Documentation and usage guide
2025-11-17 00:26:28 +02:00
yair
340cd1dd6e max pixel clock 2025-11-16 21:07:03 +02:00
yair
60f77cc884 Query actual framerate and exposure from hardware in property getters
Previously, GET_FRAMERATE and GET_EXPOSURE returned only cached values.
Now they query the actual hardware state using:
- is_SetFrameRate() with IS_GET_FRAMERATE for framerate
- is_Exposure() with IS_EXPOSURE_CMD_GET_EXPOSURE for exposure

This matches the pattern used for auto-exposure, auto-gain, and gain-boost
properties, ensuring UDP control commands return real-time hardware values
instead of stale cached values. Critical when auto-exposure is enabled as
the hardware adjusts exposure dynamically.
2025-11-16 21:06:47 +02:00
yair
6e1195c94c refine: improve exposure control precision and validation
- Lower minimum exposure from 1.0ms to 0.015ms in launch-ids.py validation
- Add exposure range validation (0.015-30000ms) to camera_control.py
- Update help text to display exposure range for better user guidance
- Adjust camera config: swap binning/subsampling values in nightcolor preset
- Add comment explaining subsampling vs binning behavior

Enhances exposure control granularity and provides clearer validation
feedback while optimizing camera configuration for low-light scenarios.
2025-11-16 06:27:51 +02:00
yair
969d716283 feat: add simplified syntax to camera control scripts
- Update camera_control.py to support 'property value' syntax
  * camera_control.py gain → gets current gain value
  * camera_control.py gain 33 → sets gain to 33
  * Add --host, --port, and --timeout parameters
  * Remove argcomplete dependency to simplify requirements
  * Maintain backward compatibility with existing commands

- Update launch-ids.py to support simplified property setting at startup
  * launch-ids.py exposure 16 → launches with 16ms exposure
  * launch-ids.py framerate 30 → launches with 30fps framerate
  * launch-ids.py gain 50 → launches with gain set to 50
  * Preserve traditional flag syntax for full backward compatibility

Both scripts now provide intuitive property-based syntax while
maintaining all existing functionality and command-line options.
2025-11-16 05:40:32 +02:00
yair
02dc12a5c4 feat: add simplified syntax to camera control scripts
- Update camera_control.py to support 'property value' syntax
  * camera_control.py gain → gets current gain value
  * camera_control.py gain 33 → sets gain to 33
  * Add --host, --port, and --timeout parameters
  * Maintain backward compatibility with existing commands

- Update launch-ids.py to support simplified property setting at startup
  * launch-ids.py exposure 16 → launches with 16ms exposure
  * launch-ids.py framerate 30 → launches with 30fps framerate
  * launch-ids.py gain 50 → launches with gain set to 50
  * Preserve traditional flag syntax for full backward compatibility

Both scripts now provide intuitive property-based syntax while
maintaining all existing functionality and command-line options.
2025-11-16 05:39:44 +02:00
yair
c95178829a ommit tests 2025-11-16 05:32:17 +02:00
yair
50f2b370d3 launch script with get//set 2025-11-16 05:28:37 +02:00
yair
19f8e1d02e with crop 2025-11-16 05:24:38 +02:00
yair
fe6312e484 add get all by default 2025-11-16 05:21:25 +02:00
yair
bc12e0ea13 Fix property getters to query hardware state instead of cached values
- PROP_AUTO_EXPOSURE now queries hardware using IS_GET_ENABLE_AUTO_SHUTTER
- PROP_AUTO_GAIN now queries hardware using IS_GET_ENABLE_AUTO_GAIN
- PROP_GAIN_BOOST now queries hardware using IS_GET_GAINBOOST

This ensures each camera reports its actual hardware state rather than
a shared cached value when properties are queried via camera_control.py
2025-11-16 05:21:09 +02:00
yair
b62451d80f Add IS_GET_GAINBOOST support to IDS uEye plugin
- Add gain-boost property to gstidsueyesrc (boolean)
- Implement is_SetGainBoost() API call in property setter and framerate/exposure function
- Add UDP control commands SET_GAIN_BOOST and GET_GAIN_BOOST
- Add --gain-boost command-line flag to launch-ids.py
- Update camera_control.py with get-gain-boost and set-gain-boost commands
- Change parameter defaults to None (exposure, framerate, gain) to respect INI file defaults
- Only set properties when explicitly provided by user - INI file is source of truth
2025-11-16 04:58:17 +02:00
yair
48f669f5c8 feat(idsueye): Add exposure range validation and query support
- Query camera's actual exposure range before setting exposure time
- Validate and clamp exposure values to supported min/max limits
- Log detailed information about range, requested vs actual values
- Add GET_EXPOSURE_RANGE command to UDP control interface
- Update Python control scripts with exposure range query support

This prevents IS_INVALID_EXPOSURE_TIME errors and ensures values are
always within the camera's capabilities. The exposure range varies by
framerate and sensor configuration.
2025-11-16 04:37:09 +02:00
yair
43878b36e2 add auto gain 2025-11-16 04:05:26 +02:00
yair
6654b99eab added auto exposure 2025-11-16 04:00:14 +02:00
yair
acbd8ec416 Add gain control support to IDS uEye camera driver
- Added 'gain' property to gstidsueyesrc element (0-100, 0=auto)
- Implemented hardware gain control using is_SetHardwareGain() API
- Added --gain/-g command-line argument to launch-ids.py
- Added SET_GAIN and GET_GAIN UDP control commands
- Updated STATUS command to include gain value
- Added get-gain and set-gain commands to camera_control.py test client
- Gain can be set at startup or adjusted dynamically during runtime
2025-11-16 03:54:29 +02:00
yair
e09938a5a1 ignore demos 2025-11-16 03:37:37 +02:00
yair
497ea26aa7 fix exposure limits 2025-11-16 03:37:26 +02:00
yair
00df62c305 Improve IDS uEye error handling with comprehensive error code mapping
- Replaced garbled is_GetError() output with human-readable error messages
- Added error code mapping for 25+ common IDS errors from uEye.h
- Enhanced camera initialization with detailed logging and context
- Error messages now include error code, name, description, and troubleshooting hints
- Added information about device/camera ID attempted and available camera count
- Example: Error 3 now shows 'IS_CANT_OPEN_DEVICE (3): Cannot open device - check if camera is connected and not in use. Camera/Device ID used: 99, Available cameras: 2'

Fixes issue where camera initialization failures showed cryptic characters instead of useful error information.
2025-11-16 03:25:33 +02:00
yair
cf0d7e14f1 ueye includes from 49.3.0 2025-11-16 03:24:41 +02:00
yair
8880dbf3cf Add display option and device-id support to launch-ids.py
- Added --display option for 1/4 sized preview window using autovideosink
- Added --camera-id and --device-id options for camera selection
- Added UDP control commands: SET_CAMERA_ID, GET_CAMERA_ID, SET_DEVICE_ID, GET_DEVICE_ID
- Updated GStreamer idsueyesrc element to support device-id property
- device-id uses IS_USE_DEVICE_ID flag for system enumeration
- camera-id continues to use user-definable ID (0 for first found)
- Updated STATUS command to include camera_id and device_id
2025-11-16 03:19:42 +02:00
yair
245f26e069 script name changed 2025-11-16 02:57:30 +02:00
yair
9051fe182a feat: add comprehensive IDS uEye camera control script
- Add full-featured launch-ids.py with command-line argument parsing
- Implement UDP control server for dynamic exposure/framerate adjustment
- Support configurable video streaming (UDP) with optional display preview
- Add exposure control in milliseconds (1.0-1000.0ms, default 10ms)
- Add framerate control (1-20200 Hz, default 750Hz)
- Include video cropping, queue configuration, and verbose/quiet modes
- Integrate argcomplete for tab completion support
- Add comprehensive error handling and validation
- Support custom camera configuration files
- Enable tee-based pipeline for simultaneous UDP streaming and display

Provides complete camera control interface with both CLI configuration
and runtime UDP control for exposure/framerate adjustments.
2025-11-16 02:36:11 +02:00
yair
487c755975 feat: add command-line parameter support to test_exposure_control.py
- Add argparse for individual get/set operations
- Support commands: get-exposure, set-exposure, get-framerate, set-framerate, status
- Add 'test' command to run full test suite (preserves original functionality)
- Show help when no parameters provided
- Add optional tab completion support with argcomplete
- Maintain backward compatibility with existing test functionality

Usage examples:
  python scripts/test_exposure_control.py                    # Show help
  python scripts/test_exposure_control.py test               # Run full test suite
  python scripts/test_exposure_control.py get-exposure       # Get current exposure
  python scripts/test_exposure_control.py set-exposure 10    # Set exposure to 10ms
  python scripts/test_exposure_control.py status             # Get pipeline status
2025-11-16 02:35:10 +02:00
yair
193244e9a3 Here's a commit message for the changes to [scripts/launch-ids.py](scripts/launch-ids.py):
```
fix(launch-ids): fix videocrop element error and enhance startup output

- Fix GstAddError caused by duplicate pipeline.add(videocrop) call
  The videocrop element was being added to the pipeline twice: once
  explicitly when crop was enabled, and again in the element linking loop.
  Removed the duplicate add operation.

- Enhance startup configuration display
  Display all configured parameters at startup in a formatted summary:
  * Camera config file path
  * Exposure time (ms)
  * Framerate (Hz)
  * Crop settings (pixels or disabled)
  * Queue buffer size (if configured)
  * Video stream destination (UDP host:port)
  * Control server port (or disabled status)
  * Complete pipeline description

The output is now formatted with separators and aligned labels for
better readability, making it easier to verify settings at startup.
```
2025-11-16 02:20:12 +02:00
yair
083cd86702 fix: correct exposure units from seconds to milliseconds
- Update idsueyesrc exposure property to use milliseconds (per gst-inspect)
- Fix default exposure value from 0.016 to 10ms
- Update validation range to 1.0-1000.0ms in control server
- Correct all documentation and examples in UDP_CONTROL_PROTOCOL.md
- Update test_exposure_control.py to use millisecond values

Resolves unit mismatch between documented seconds and actual milliseconds
expected by the idsueyesrc GStreamer element.
2025-11-16 01:58:36 +02:00