Background

There is ovbious need in integrating video support into EMC [emc]. From simple live video window for manual adjusting to full fledged CV implementations for computer aided marker tracking.

First attemtps were documented on EMC forum [emc-forum-video]. Propoused solution was to patch gqcam, very simple V4L application. While this solution is very simple it’s hard to add CV algorithms into it. So after some investigations on the topic choices were limited to two frameworks: GStreamer and CamUnits [camunits]. Second framework looks more reasonable for this task since it was created for CV tasks and has very clean codebase. It’s main concept is Unit — stream processing unit which may perform some image conversion.

After choosing CamUnits as base framework there was some work going into patching camview tool from it to allow embedding in Axis window via XEmbed protocol. But soon it comes obvious that using stock camview is not wise for EMC for several reasons:

  • controls are eating too much space when embeded in Axis;

  • needed controls are hard to find;

  • user have to create chain even in simple cases.

For camview clone hard way was choosen — create python bidings [pycamunits] and then write simple python script. Since CamUnits is GLib based and GUI part is using Gtk it was not that hard. But after creating python bindings simple camview replacement (without manager/control widgets) may be written in ~30 lines of code!.

List of plugins

There are several plugins shipping along with camview-emc. Here is list of plugins packaged into camunits-plugins-emc-misc:

  • input.image: Use image as input. Generates new frame at requested rate. Targeted for testing different processing algorithms. More simple solution then input.log plugin. Based on FreeImage library [freeimage].

  • convert.flip: Flip image in horozontal or/and vertical direction. Not very useful for V4L2 cameras since there is one in libv4l2. Vertical flip is very efficient and horizontal is pretty fast on RGB, BGR, … images with 24 bits per pixel. Horizontal flip is slow on Gray images (with 8 bpp).

  • emc.crosshair: Draw crosshair on image. Corrently supports simple crosshair and additional circle with adjustable radius. May be drawn in simple or in XOR mode (which gives good effect only for white).

  • filter.pip: Draw image in small area in left bottom corner (0.25 of main image size). Useful for debugging and tuning different conversion algorithms.

  • detect.hough: Perform Hough circles detection on image. Only 8 bit grayscale images are accepted as input. Rectangles are drawn around all detected circles and first one is added to frame metadata under names marker.x, marker.y, marker.z.

Additional plugins that may be useful but not packaged yet:

References