Update getting started with image streams authored by Vsevolod Vlaskine's avatar Vsevolod Vlaskine
[[_TOC_]] [[_TOC_]]
# **cv-cat**: image streaming and processing
# hello world # hello world
If your laptop or desktop has a webcam, try: If your laptop or desktop has a webcam, try:
``` ```
> cv-cat --camera "view;null" > cv-cat --camera "view;null"
``` ```
**view;null** above means: view image stream, then output nothing to stdout.
# basic input/output and image filters
If you don't specify **null** the images **cv-cat** reads from your camera will be output to stdout in a simple binary format (see **image data format** section below). Try:
```
> cv-cat --camera | cv-cat "view;null"
```
**cv-cat** sequentially applies filters from the command line. Try:
```
> cv-cat --camera "invert;flip;timestamp;view;null"
```
Now, try to save images in a file and then play them back.
Run the following command, wait for ten seconds and then press ctrl-c
```
> cv-cat --camera > images.bin
```
Play back saved images
```
> cat images.bin | cv-cat "view;null"
```
# image data format
## example
In previous example **cv-cat** plays back the images as fast as it can, not in realtime.
To play back in realtime, let us use [**csv-play**](https://gitlab.com/orthographic/comma/-/wikis/csv/getting-started:-basic-data-manipulations,-ascii-and-binary-data).
To use **csv-play** we need to know the binary format of the stream:
```
> cat images.bin | cv-calc format
t,3ui,s[921600]
```
I.e. the format of the images output by **cv-cat** is:
- **t**: 8-byte timestamp
- **3ui**: 3 4-byte integers (we will look into them in a minute)
- **s[921600]**: followed by 921600 bytes of image (depending on your camera output, the size may be different; in my case, those are 640x480 3-byte RGB images, hence 640x480x3=921600)
Now, let's play back **images.bin** in real time:
```
cat images.bin | csv-play --binary t,3ui,s[921600] | cv-cat "timestamp;view;null"
```
## image data format details
...
# potentially unmaintained documentation at other repository fork: # potentially unmaintained documentation at other repository fork:
See [https://github.com/acfr/snark/wiki/get-started-with-image-data] See [https://github.com/acfr/snark/wiki/get-started-with-image-data]
\ No newline at end of file