Hi @Rowan-Dempster ,
Please take a look at this example (you can build and run it too) : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/add-new-image-tools/tools/voxl-image-repub.cpp
This app can accept a regular image (RAW8 or YUV) and either re-publish it unchanged or crop and publish the result. Sometimes this is useful for quickly cropping an image that is fed into a different application that expects a smaller image or different aspect ratio.
The app shows how to subscribe and handle ion buffer streams.
Usage:
voxl2:/$ voxl-image-repub
ERROR: Pipe name not specified
Re-publish cropped camera frames (RAW8 or YUV)
Options are:
-x, --crop-offset-x crop offset in horizontal dimension
-y, --crop-offset-y crop offset in vertical dimension
-w, --crop-size-x crop size in horizontal dimension (width)
-h, --crop-size-y crop size in vertical dimension (height)
-o, --output-name output pipe name
-u, --usage print this help message
The cropped image will be centered if the crop offsets are not provided.
typical usage:
/# voxl-image-repub tracking --crop-size-x 256 --crop-size-y 256
/# voxl-image-repub tracking --crop-size-x 256 --crop-size-y 256 --crop-offset-x 128 --crop-offset-y 128
example re-publishing ion buffer image as regular image (which you can view in voxl-portal ) :
voxl-image-repub tracking_front_misp_norm_ion -o test
(you can see which ion pipes are available by running voxl-list-pipes | grep _ion)
Please note that without the previous fix that i posted above, the client process that receives and uncached ION buffer will incur extra CPU load while accessing this buffer. For example, the same voxl-image-repub client uses 1.7% cpu while republishing the normalized image (cached ion buffer), while using 7.3% cpu republishing an image from an uncached ION buffer. (cpu usage % using one of the smaller cores).
Please try and let me know if you have any questions.
I know this cached / uncached buffering may be a bit confusing, but i will document this a bit more to help explain it a little better.
Alex