Skip to end of metadata
Go to start of metadata

Multiple rectangular regions can be specified in roi operation of cv-calc (like the draw operation), so that:

  • everything outside these regions in the input images is set to zero, or
  • these regions are cropped out of input images into separate images (the arguments prefixed to input will be removed).

All images in the input stream must have same number of regions. Any region with zero width or height (e.g. 0,0,0,0) will be ignored and, if needed, can be used so that all images have same number of regions.

If all the bounding boxes for an image have zero area, then the whole image will be set to zero

> # mask in 2 rectangles
> cat images.bin \
  | csv-paste "value=250,675,488,903,596,604,784,900;binary=8ui" "-;binary=t,3ui,s[5013504]" \
  | cv-calc roi  --fields=rectangles,t,rows,cols,type --rectangles=2 --binary=8ui,t,3ui \
  | csv-bin-cut '8ui,t,3ui,s[5013504]' --fields 9-13 \
  > masked.bin

> # crop out 2 rectangles ( csv-bin-cut not needed in this case )
> cat images.bin \
  | csv-paste "value=250,675,488,903,596,604,784,900;binary=8ui" "-;binary=t,3ui,s[5013504]" \
  | cv-calc roi --crop --fields=rectangles,t,rows,cols,type --rectangles=2 --binary=8ui,t,3ui \
  > cropped.bin



  • No labels


  1. Aneel Rathore; if one image in the stream has 5 bounding boxes and the next 3 bounding boxes, how should it be expressed?

    1. A related question: is it worth making this consistent with cv-calc draw operation (at least for rectangles)?