Search code examples
.netcameramotion-detection

Motion detection of a specific object in .net


I need to make a .net application where I must detect a specific object the user is holding, using a camera.

If the object must have some specific characteristics so that it can be easily recognized and detected from the surrounding space, please give me some tips (ex a green cube?)

What would be the best technique/.net library to use? I need to translate in realtime the user's hand movement and display an animation on screen accordingly.


Solution

  • for motion detection: find the good features(corners,ie.) and feed them into a lucas-kanada optical flow algorithm. opencv has those functions but I don't know if opencvnet has it or not.

    if your object has a specific feature, like being the greenest in the scene for example, you can use thresholding. otherwise you need to use pattern recognition techniques.
    pseudo code:

    threshold1 = 128
    threshold2 = 64
    foreach Pixel p in Picture
     if (p.Green > 128) and (p.Red < threshold2) and (p.Blue < threshold2)
       outputImage.CurrentPixel = 255
    else
       outputImage.CurrentPixel = 0
    

    here you'll have your image which greens are shown as white and the rest is black