Skip to content
Update getting started with image streams authored by Vsevolod Vlaskine's avatar Vsevolod Vlaskine
......@@ -96,10 +96,30 @@ Output just raw images without header and then read and view them:
> cv-cat --camera --output no-header | cv-cat --input "rows=480;cols=640;type=3ub;no-header" "view;null"
```
You can load it as a **numpy** array or **cv.mat**/**cv::Mat** in **OpenCV**.
You can trivially load those raw images as a **numpy** array or **cv.mat**/**cv::Mat** in **OpenCV**.
## image filters
...
**cv-cat** implements dozens of image filters for
- basic image manipulations like **resize**, **transpose**, etc
- image format conversions like **color-convert** for color format conversions, **convert-to** for color depth and offset conversions, etc
- image encoding and saving as PPM, PNG, JPG, gz, etc: **encode**, **file**, **save** filters, etc
- image partitioning, finding edge, thresholding, despeckling, mapping, etc: e.g. see **partition**, **hard-edge**, **kmeans** filters, etc
- channel manipulations, e.g. see **ratio**, **linear-combination**, **split**, **merge**, etc
- arithmetic and bitwise operations, e.g. see **add**, **subtract**, **bitwise**, etc
- "forking" image streams, e.g. see **tee**
- unpacking images, e.g. see **unpack**, **bayer**, filters, etc
- remapping and undistorting, see e.g. **remap** and **undistort** filters
**cv-cat** filters can be chained together as in examples in previous sections. They also are parallelised.
Thus, before implementing your own bit of image processing, it might be worth to run **cv-cat --help --verbose**: unless you need something very novel or idiosyncratic, there is a high chance a **cv-cat** filter or a combination of a couple of filters already will do all you need.
(And if something is missing, please feel free to create a ticket: either we add the functionality for you or a tutorial how to achieve your functionality with the existing **snark** utilities.)
You can run **--help** as following to search it in **less**:
```
> cv-cat --help --verbose 2>&1 | less
```
## image files and file lists
single image, from/to ...
......@@ -113,7 +133,21 @@ output image lists ...
combining both ...
## videos
...
### convert video into an image stream
**cv-cat** can read common video formats and convert the video into an image stream, which you can manipulate then as you need:
```
cv-cat --file your-video.MOV "view;null"
```
### convert image stream into a video
You can use **ffmpeg** or its other incarnation **avconv** to stitch videos from a **cv-cat** image stream (**timestamp** and **view** filters are added so that you can see what you are recording).
It would look as following (press ctrl-c, when you want to stop):
```
> cv-cat --camera --output no-header "timestamp;view;encode=png" | ffmpeg -y -f image2pipe -r 25 -c:v png -i pipe: -c:v libx264 -threads 0 -b:v 2000k -r 25 -preset slow -crf 22 video.mp4
```
Depending on your desired video quality, frame rate, compression, etc, you might need to change the command line parameters of **ffmpeg**. Sometimes it's not easy, but there is a lot of **ffmpeg** online documentation, Q&A, recipes, etc.
# **cv-calc**: more image manipulations
...
......
......