Skip to content

About

One unified Python API for Hikrobot, Basler, Allied Vision and GenICam cameras

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

dynamic-machinevision

License: MIT Python 3.9+

One unified, vendor-agnostic Python API for industrial machine-vision cameras (Hikrobot, Basler, Allied Vision, GenICam / GigE Vision).

Swap camera hardware without rewriting your computer vision pipelines, inspection algorithms, or AI inference scripts.


Key Features

  • Vendor-Agnostic Interface: A single CameraDevice base class standardizes enumeration, connection, triggering, streaming, and parameter configuration across different manufacturers.
  • Built-in Camera Simulator: Develop, debug, and test your vision applications without physical camera hardware attached. Generates color bars, noise, checkerboard patterns, and configurable synthetic defects.
  • Pluggable Driver Architecture: Dynamic registry supporting multiple backends (simulator, hikrobot, genicam/basler).
  • Zero-Copy NumPy / OpenCV Integration: Acquired frames are directly available as NumPy arrays with fast BGR/RGB conversions.
  • Context Manager Support: Clean lifecycle management (with manager.open("sim:0") as cam:).
  • Command Line Interface (dynamic-mv): Instant camera discovery, live parameter query, and frame capture from the terminal.

Architecture

+-------------------------------------------------------------+
|               Your Application / AI Pipeline                |
+-------------------------------------------------------------+
                              |
                     [ CameraManager ]
                              |
         +--------------------+--------------------+
         |                    |                    |
 [ SimulatorDriver ]  [ HikrobotDriver ]   [ GenICamDriver ]
   (Virtual/Demo)       (dynamic-hikrobot)   (Basler/GigE/USB3)

Installation

pip install dynamic-machinevision

With optional CLI and image preview dependencies:

pip install "dynamic-machinevision[cli]"

Quick Start

1. Python API

from dynamic_machinevision import CameraManager

# Initialize manager
manager = CameraManager()

# Discover available cameras across all registered drivers
devices = manager.list_devices()
for dev in devices:
    print(f"[{dev.driver}] {dev.name} (SN: {dev.serial_number})")

# Open camera using URI or serial number
with manager.open("sim:0") as cam:
    # Set standard parameters
    cam.set_parameter("exposure_time_us", 15000.0)
    cam.set_parameter("gain_db", 6.0)

    # Start stream and grab frame
    cam.start_grabbing()
    frame = cam.grab(timeout_ms=1000)
    
    print(f"Captured frame #{frame.frame_id}: {frame.width}x{frame.height} ({frame.pixel_format})")
    
    # Use with OpenCV or NumPy
    image_bgr = frame.to_bgr()

2. CLI Usage

# List all connected and simulated cameras
dynamic-mv list

# Grab a test frame and save to disk
dynamic-mv grab --device sim:0 --pattern checkerboard --output frame.png

# Query camera parameters
dynamic-mv info --device sim:0

Part of the Dynamic Industrial Ecosystem

dynamic-machinevision is an open-source component of the Dynamic Industrial Power ecosystem:


License

MIT License — Copyright (c) 2026 Dynamic Industrial Power.

About

One unified Python API for Hikrobot, Basler, Allied Vision and GenICam cameras

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages