Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image_plugin for MADS

This repository provides two plugins for MADS:

  • image_source: grabs frames from the first available camera via OpenCV and publishes each frame as a JPEG-encoded blob.
  • image_sink: receives an image blob and stores it as a .jpg file in the current working directory.

Required MADS version: 2.4.3.

OpenCV is used to access the camera and encode frames. A system-installed OpenCV is preferred; if none is found, it is fetched and built (core, imgproc, imgcodecs, videoio only) via CMake FetchContent, which can take a while the first time.

Supported platforms

Currently, the supported platforms are:

  • Linux
  • MacOS
  • Windows

Installation

Linux and MacOS:

cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$(mads -p)"
cmake --build build -j4
sudo cmake --install build

Windows:

cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$(mads -p)"
cmake --build build --config Release
cmake --install build --config Release

INI settings

image_source

[image_source]
# Capture resolution: a preset (QVGA, VGA, SVGA, HD, FULLHD) or an explicit
# "WIDTHxHEIGHT" spec, e.g. "1024x768". The camera may not support the exact
# resolution requested; the actually captured size is reported in the
# published "width"/"height" fields.
resolution = VGA
# Capture mode: "RGB" for color frames, "BW" for grayscale.
mode = BW

Each published message carries width, height, mode, and format ("jpg") fields, plus the raw JPEG bytes as the message blob.

image_sink

[image_sink]
# Base name for saved images; each is written as "<basename>_NNN.jpg" with
# an incrementing, zero-padded counter. On startup, the counter resumes
# after the highest-numbered file already present, so restarts never
# overwrite earlier captures.
basename = capture
# Stops after grabbing 5 frames (default=5)
# Set to 0 for unlimited, but watch for disk space usage!
count = 5 

All settings are optional; if omitted, the default values are used.

Executable demo

On MacOS, each plugin is also compiled as a standalone executable (image_source / image_sink); on Linux and Windows, a matching *_main executable is built alongside the loadable .plugin/.dll. Running it exercises the plugin outside of a MADS agent:

  • image_source opens the default camera, captures one VGA/BW frame, prints the resulting JSON metadata, and writes it to capture_test.jpg in the current directory.
  • image_sink writes a minimal placeholder JPEG blob to capture_000.jpg (or the next free index), demonstrating the save path without requiring a camera.

About

Image (or binaty) transmission via MADS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages