Skip to content

Region of Interest: ROI

Hoël Vasseur edited this page May 4, 2016 · 8 revisions

Principle

Among all functionalities of open VIVOE, one of the greatest is the Region of Interest or ROI. Basically it gives the possibility to the user to zoom on the streams.

This can be performed on the Service Provider side, as well as on the Service User side. VIVOE defines three different types of ROI:

  • Non-Scalable ROI
  • Scalable ROI that gather two kinds of ROI together:
    • decimated ROI
    • Interpolated ROI

Non-scalable ROI is defined when only the channel's resolution and ROI's origin parameters are set in the MIB. It is define as non-scalable because the origin of the zoom can be moved or resized. Decimated ROI is defined when ROI's origin and extent parameters are set in the MIB, and ROI resolution < ( ROI extent - ROI origin ). It is defined as decimated because the size of the ROI is less than its resolution, and so it will be down scaled to fit its resolution. Interpolated ROI is defined when ROI's origin and extent parameters are set in the MIB, and ROI resolution > ( ROI extent - ROI origin ).It is defined as interpolated because the size of the ROI is greater than its resolution, and so it will be up scaled to fit its resolution.

Make it work in open VIVOE

Open VIVOE aims to let the user defined the CPU-consumptive processes to the user, so it can use, depending of its device, hardware acceleration. This is why the "gst_source" and "gst_sink" keys have been creaed in configuration file. Scaling is a CPU-consumptive process, so open VIVOE aims to let the user define the Gstreamer element he will use for scaling. In order to do so, we have created a gstreamer element: "vivoe-roi" that has a unique property: "scalable", which can be set to true, or false.

This element should be used right before the scaling element in gst_source command line in vivoe-mib.conf, for sclable ROI, and whenever it is needed for non-scalable ROI.

Cropping or Scaling a video can only be performed on RAW video, it is meaningless to scale a encoding video. Here are two examples of ROI: a non-scalable and a scalable as they should be defined in configuration file.

gst_source=v4l2src device=/dev/video0 ! capsfilter caps="video/x-raw,format=I420,width=640,height=480,interlace-mode=(string)progressive,framerate=(fraction)20/1" ! vivoe-roi scalable=false

gst_source=v4l2src device=/dev/video0 ! capsfilter caps="video/x-raw,format=I420,width=640,height=480,interlace-mode=(string)progressive,framerate=(fraction)20/1" ! vivoe-roi scalable=true ! videoscale ! avenc_mpeg4

The first one is a non-scalable ROI, on a RAW video. The second one is a scalable ROI, on a MPEG-4 video: you can notice that the video encoding is performed after the ROI.

Then, the ROI can be controlled through the MIB by setting the parameters:

  • channelHorzRes
  • ChannelVertRes To change the ROI size.
  • channelRoiOriginTop
  • channelRoiOrigintLeft To change the origin of the ROI.
  • channelRoiExtentBottom
  • channelRoiExtentRight to change the ROI's zoom soze, but with conversing the same resolution.