Search Unity

Webcam pattern recognition?

Discussion in 'General Discussion' started by AnthonyPaulO, Apr 5, 2021.

  1. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    I have a webcam setup pointed down at a map that my son and I use to fight battles on with minis. I’m writing some code to help simplify some of the tracking and stats and other such info, but part of what I need to do involves tracking the minis, which means I need to be able to detect them with the webcam and differentiate among them. For example, perhaps to make it easier for the pattern recognition I can put a special color coded round marker around the base of the mini, and during my setup process I can have it recognize each piece, so that while we play I can move it around and it can recognize where the minis are. Does anyone know of a good library for this that doesn’t involve the complexities of training software like opencv/tensorflow? Many thanks in advance!
     
    Last edited: Apr 5, 2021
  2. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    Have you considered python? It looks like there are a lot of libraries that do something like that. I couldn't recommend any specifically.
     
  3. BennyTan

    BennyTan

    Joined:
    Jan 23, 2014
    Posts:
    141
    Is there no way to make use of Vuforia? I know it worked with webcam in the editor previously.
     
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    You'll need OpenCV. Because that's straight into OpenCV valley. You don't really need Python for that.

    The simplest thing you could do is to slap Aruco markers onto playing pieces. If you want more complex approach, you could google for exmample "opencv playing card detector". In this case you'll try to split the scene into segments and then locate possible pieces, "undistort" them and try to guess what you're looking at.

    Trying to do that with machine learning, by the way, is likely to end up being too time consuming.

    It is likely possible to do that with Vuforia, but most of the stuff vuforia offers can be done with raw OpenCV.