iCub-main
motionCUT

Independent Motion Detector Version:1.0.

Collaboration diagram for motionCUT:

Independent Motion Detector Version:1.0.

# Description

The module exploits the pyramidal Lucas-Kanade algorithm to detect independent moving points over a selectable grid of nodes. The algorithm is designed in such a way that it works also - and especially - with moving cameras.

Note
The name motionCUT stands for motion Cover/Uncover Trick and refers to its working principle that is detailed in the paper: Ciliberto C., Pattacini U., Natale L., Nori F. and Metta G., "Reexamining Lucas-Kanade Method for Real-Time Independent Motion Detection: Application to the iCub Humanoid Robot", IEEE/RSJ International Conference on Intelligent Robots and Systems, San Francisco, CA, USA, 2011.
If you're going to use the motionCUT for your work, please quote it within any resulting publication.
We warmly suggest to use OpenCV in conjunction with multi-threading layers such as TBB in order to achieve high performances for motion detection. Refer to the OpenCV documentation for the details.
A video on iCub employing motionCUT can be seen here.

# Parameters

• – name : Specifies the stem name of ports created by the module.
• – coverXratio : Portion of the x-axis of the image covered by the grid nodes. Example: if the value is 0.75, then the central 3/4 of the x-axis will be covered with points.
• – coverYratio : Portion of the y-axis of the image covered by the grid nodes. Example: if the value is 0.75, then the central 3/4 of the y-axis will be covered with points.
• – nodesStep : Step (in pixels) between two consecutive grid nodes.
• – winSize : Window size used by the algorithm.
• – recogThres : Error threshold (in percentage) that allows discriminating between background and independent moving nodes as result of a matching carried out on the windows whose size is determined by 'winSize' parameter. Usually very small values, such as 0.5%, have to be used. Indicatively, a value of 0.5% means that the two templates for the matching must have a similarity measure of 99.5% to prevent the relative node from being recognized as independent moving node. Importantly, this parameter is also significantly affected by how well the matching is performed; as result, for increasing OpenCV versions, the threshold needs to be reduced (e.g. 0.01%).
• – adjNodesThres : This parameter allows filtering out the salt-and-pepper noise over the output image, by specifying the minimum number of adjacent nodes that must be active (i.e. that undergo the motion) in the neighbourhood of any single node to keep it active.
• – blobMinSizeThres : This parameter allows filtering out blobs whose nodes number is lower than the provided value.
• – framesPersistence : This parameter allows increasing the node persistence over consecutive frames implementing a sort of low-pass filter. Its value specifies the number of consecutive frames for which if a node gets active it is kept on.
• – cropSize : This parameter allows changing the the side of a squared cropping window placed on the center of the largest blob detected. Default value is auto, meaning that the cropping window will adapt to the size of the blob.

# Input Ports

• /motionCUT/img:i [yarp::sig::Image] [default carrier:udp]: Accepts the incoming images.

# Output Ports

• /motionCUT/img:o [yarp::sig::Image] [default carrier:udp]: Outputs the input images with the grid layer on top. This port propagates the time-stamp carried by the input image.
• /motionCUT/nodes:o [yarp::os::Bottle] [default carrier:udp]: Outputs the input x-y location of the currently active nodes in this format: (nodesStep 'val') ('n0.x' 'n0.y') ('n1.x' 'n1.y') ... . This port propagates the time-stamp carried by the input image.
• /motionCUT/blobs:o [yarp::os::Bottle] [default carrier:udp]: Outputs the input x-y location of blobs centroids along with their size in this format: ('b0.cx' 'b0.cy' 'b0.size') ('b1.cx' 'b1.cy' 'b1.size') ... . The output blobs list is sorted according to their size (decreasing order). This port propagates the time-stamp carried by the input image.
• /motionCUT/crop:o [yarp::sig::Image] [default carrier:udp]: Outputs a window of fixed size obtained from a ROI around the center of mass of the largest blob detected.
• /motionCUT/opt:o [yarp::sig::Image] [default carrier:udp]: Outputs monochrome images containing just the grid nodes signaling independent movements. This port propagates the time-stamp carried by the input image.

# Services

• /motionCUT/rpc [rpc-server]:
   The parameters winSize, recogThres, adjNodesThres, blobMinSizeThres, framesPersistence, cropSize,
verbosity can be changed/retrieved through the commands set/get. Moreover, the further
switch inhibition can be accessed in order to enable/disable the motion detection at run-time.

. This service is described in ()