Skip to content

Commit

Permalink
Add Python sample for sending image data.
Browse files Browse the repository at this point in the history
  • Loading branch information
KerstinKeller committed Nov 24, 2023
2 parents 4b7fc18 + 47cd9f5 commit 194a639
Show file tree
Hide file tree
Showing 139 changed files with 3,332 additions and 7 deletions.
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@ The ecal-camera-samples is a set of projects around sending and receiving image

After installation, you have 2 components available:

1. A **sender application** `ecal_camera_snd` that publishes the data of a webcam device to an eCAL topic
2. A **monitor plugin** that can display the image data in the eCAL Monitor
1. A **sender application** `ecal_camera_snd` (C++) that publishes the data of a webcam device to an eCAL topic, and a Python version achieving the same thing, called `webcam_grabber`.
2. A **monitor plugin** (C++) that can display the image data in the eCAL Monitor

# How to install prebuilt binaries
# Python Setup

It's recommended to start the `webcam-grabber` in a virtual environment.
Then install all necessary requirements
```bash
pip install -r ./requirements.txt
```
Additionaly, install the python wheel matching your python version, and operating system.
E.g. if you are using Python 3.11 64bit on a Windows operating system, and eCAL 5.12.1, run
```bash
pip install ./ecal5-5.12.1-cp311-cp311-win_amd64.whl
```
The wheels can be downloaded from the Github releases page [here](https://github.com/eclipse-ecal/ecal/releases).


# C++ Setup - How to install prebuilt binaries

1. [Install eCAL](https://eclipse-ecal.github.io/ecal/getting_started/setup.html) (obviously 😉)
2. Go to the [release page](https://github.com/eclipse-ecal/ecal-camera-samples/releases) and pick the version matching your OS and eCAL Version
Expand All @@ -21,7 +36,7 @@ After installation, you have 2 components available:
sudo dpkg -i ecal-camera-samples*.deb
```

# How to build it yourself
# C++ Setup - How to build it yourself

## Windows

Expand Down Expand Up @@ -68,17 +83,17 @@ After installation, you have 2 components available:

# Usage

## eCAL Camera Sender
## eCAL Camera Sender (C++)

This application captures the stream from a specified camera and publishes it via eCAL. Optionally, the resolution of the image as well as a maximal framerate can be specified.

Usage:
```
```bash
ecal_camera_snd [topicName] [cameraName] [OPTIONAL_resolutionWidth] [OPTIONAL_resolutionHeight] [OPTIONAL_maxFps]
```

Command Line:
```
```bash
topicName: Name of the eCAL Topic to publish to
cameraName: Path to camera. Call --list-cameras to list
available cameras.
Expand All @@ -95,6 +110,24 @@ Example:
ecal_camera_snd compressed_image_protobuf /dev/video0 640 480 10
```

## eCAL Camera sender (Python)

Run the python script `webcam-grabber.py`.
You will be able to see the published data in eCAL Monitor.

```bash
python .\webcam-grabber.py --help
usage: webcam-grabber.py [-h] [--camera-id CAMERA_ID] [--compressed] [--topic-name TOPIC_NAME]
optional arguments:
-h, --help show this help message and exit
--camera-id CAMERA_ID
Which camera to use for feed
--compressed send compressed image instead of raw image
--topic-name TOPIC_NAME
topic name to publish
```

## eCAL Monitor Plugin

After running cmake --install on the monitor plugin, you can view the published camera image in the eCAL Monitor GUI in the detailed view under the Camera Receiver tab.
Expand Down
34 changes: 34 additions & 0 deletions ecal_camera_snd_python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Webcam Grabber

This sample code demonstrates how to read camera input as images and publish them on eCAL in protobuf format, as ROS compressed or raw images.

## Installation
It's recommended to start the `webcam-grabber` in a virtual environment.
Then install all necessary requirements
```
pip install -r ./requirements.txt
```
Additionaly, install the python wheel matching your python version, and operating system.
E.g. if you are using Python 3.11 64bit on a Windows operating system, and eCAL 5.12.1, run
```
pip install ./ecal5-5.12.1-cp311-cp311-win_amd64.whl
```
The wheels can be downloaded from the Github releases page [here](https://github.com/eclipse-ecal/ecal/releases).


## Usage
Run the python script `webcam-grabber.py`.
You will be able to see the published data in eCAL Monitor.

```
python .\webcam-grabber.py --help
usage: webcam-grabber.py [-h] [--camera-id CAMERA_ID] [--compressed] [--topic-name TOPIC_NAME]
optional arguments:
-h, --help show this help message and exit
--camera-id CAMERA_ID
Which camera to use for feed
--compressed send compressed image instead of raw image
--topic-name TOPIC_NAME
topic name to publish
```
26 changes: 26 additions & 0 deletions ecal_camera_snd_python/datatypes_collection/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
8 changes: 8 additions & 0 deletions ecal_camera_snd_python/datatypes_collection/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "datatypes_collection"
license = {file = "./LICENSE.txt"}
version = "0.1.0"
Empty file.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
27 changes: 27 additions & 0 deletions ecal_camera_snd_python/datatypes_collection/ros/builtins_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 194a639

Please sign in to comment.