The OpenCV Service is a library of vision functions.
Some of the functions are
Fast Lucas Kanade optical tracking
Background forground separation
The OpenCV Service has several dependencies, so it will need to be installed before it is used. You may install it on the Runtime panel. Highlight the OpenCV service right-click -> install. A restart is necessary, after installing new services.
The same can be achieved programmatically with the following line of Python
Next you can create start a new OpenCV service by right clicking -> start
Starting a new service can be done programmatically with the following line of Python
Many of the functions in OpenCV
are implemented as pipeline filters in MRL. That is a filter can run, and the output of one can be connected to the input of another. Not all filters are capable of "pipelining"
- select from the available filter
- is press the arrow button to move it into the pipeline
- is to give it a unique name
How to Modify an OpenCV Filter
Some filters have configuration which can be changed. You must highlight the filter your interested in, and further configuration may up. Below is the Canny filter low & high threshold and an aperture size which can be changed.
How to Remove an OpenCV Filter
Just highlight and press the left arrow button to remove a filter from the pipeline
The ever popular face detect
Lucas Kanade optical tracking will track a selected corner through the video stream. Load this filter, find a good feature and click the mouse on it. It will set a point where the mouse was click, as the image moves, the point will move with the object selected.
The Canny filter is used for detecting edges in a video stream. This can be useful in object segmentation
The function finds the edges on the input image and marks them in the output image edges using the Canny algorithm. The smallest value between lowThreshold and highThreshold is used for edge linking, the largest value is used to find the initial segments of strong edges.
apertureSize - aperture parameter for the Sobel operator
lowThreshold - lower threshold on minimal amount of pixels required for edge linking
highThreshold - upper threshold on max amount of pixels required for edge linking
myfilter = opencv.getFilter("canny")
myfilter.apertureSize = 3
myfilter.lowThreshold = 10.0
myfilter.highThreshold = 200.0
This filter will find prominent corners in a video stream. After these points are gathered, tracking can be done with the same set of points. LKOpticalTrack may use this method to initialize a set of good tracking point.
And InRange which filters on Hue Saturation and Value.
Many of the filters output positional points, which in turn can be consumed by other services in MRL. For example a pan / tilt kit with servos can track the point in Face Detect or LKOptical Track.
The addtion or removal of filters can be controlled through the Python script in MRL, such that when a motion appears, a program could remove the motion filter and set an LKOptical tracking point to track new motion.
Not all cameras work with OpenCV - here is a list of supported cameras from willowgarage