Skip to content

Region of Interest: ROI

Hoël Vasseur edited this page May 17, 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.

As an example, here what you get in full frame resolution:

And now after applying the ROI:

This can be performed on the Service Provider's side, as well as on the Service User's side. VIVOE defines three 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 OpenVivoe

OpenVivoe 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 OpznVivoe aims to let the user define the Gstreamer element used for scaling. In order to do so, we have created two Gstreamer plug-ins: "vivoecrop" and "viveocaps". Those are simple elements, with no property to configure and to place in the pipeline, if you want the SP or the SU to be configured as a ROI.

"viveocrop" element should be used before the scaling element in the pipeline, "vivoecaps" should be use after. A non-scalable roi needs only the vivoecrop element, but as scalable ROI will need both element in pipeline. These two elements perform the same job as the classic videocrop and capsfilter elements but they directly get their values from the MIB, and automatically update themselves when a change is made in the MIB.

Here are two examples of ROI: a non-scalable and a scalable as they should be defined in configuration file.

Non-scalable:

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" ! vivoecrop

Scalable:

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" ! vivoecrop ! videoscale ! vivoecaps ! 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's origin:

  • channelRoiOriginTop
  • channelRoiOrigintLeft

To change the ROI's size

  • channelRoiExtentBottom
  • channelRoiExtentRight