Blog from July, 2018

csv-split can also stream the data associated with multiple ids, to specific sockets, named pipes or files. See csv-split --help for more details about the semantics.

You can mix publishing to tcp sockets, local sockets, files, or pipes, if you need.

> # publish data corresponding to ids 2 and 3 to tcp:8888, 0 to tcp:9999 and the rest to stdout
>  csv-paste line-number "line-number;size=5;index" \
     | csv-split --fields ,id "2,3;tcp:7777" "0;tcp:8888" "...;-" > other_ids.csv

> # in separate terminal
> socat tcp:localhost:7777 - | head
6635893,3
6635897,2
6635898,3
6635902,2
6635903,3
6635907,2
6635908,3
6635912,2
6635913,3
6635917,2

> socat tcp:localhost:8888 - | head
28950290,0
28950295,0
28950300,0
28950305,0
28950310,0
28950315,0
28950320,0
28950325,0
28950330,0
28950335,0

> head other_ids.csv
1,1
4,4
6,1
9,4
11,1
14,4
16,1
19,4
21,1
24,4
 

csv-split works as before (splitting data into files) if no streams are specified. Furthermore if there are streams assigned to some ids and none to "..." , then the data relating to the remaining ids is discarded.

Besides headers, cv-calc roi and draw operations can now read the shapes from csv files. To incorporate this, usual csv options have also been added to the shape attributes.

If the shapes have (reverse) index fields it will draw / apply all the shapes in the block in each file on single image, otherwise it takes only one shape per file.

If the shapes file has field t (timestamp), then the shapes in the block are drawn only to the image with corresponding timestamp, otherwise each block of shapes is drawn on the next available image (see cv-calc --help for details).

To try following examples, download this image.

> cv-cat --file 20180101T000000.jpg \
    | cv-calc draw --rectangles=<( echo "800,500,1600,1700" )";fields=min/x,min/y,max/x,max/y;color/r=255;weight=3" \
                   --circles=<( echo "2800,1225,300" )";fields=centre/x,centre/y,radius;color/b=255;weight=3" \
                   --labels=<( echo "1,1200,1100,cat01"; echo "0,2800,1225,cat02" )";fields=index,position/x,position/y,text;color/g=255;weight=2" \
    | cv-cat "encode=jpg" --output no-header
    > drawn.jpg

> eog drawn.jpg