I'm a software developer not experienced in AI or machine learning, but I'm now interested in developing this kind of software. I want to develop software that recognizes some specific objects, specifically, animals from a video stream (or a sequence of static images).

I saw there's a library called openCV which is often commented in this forum, but what I saw so far is this library is a helper for working with images, I didn't find the object recognition or self learning part.

Is openCV a good starting point? better go for some theory first? or there are other already developed libraries or frameworks aimed for object recognition?

EDIT To give some context: I will have ona camera checking a landscape, mostly static but some leaves may move with the wind or some person may step in, and I want to get an alert when some animal is into view, I can reduce the "animals" to only birds (not always I will have a nice bird/sky contrast).

I did some work with supervised neural networks some 15 years ago and studied some AI and machine learning theory, but I guess things have improved way too much since then, that's why I was asking for some more practical first steps.

Thank you

  • 5
    $\begingroup$ xkcd.com/1425 $\endgroup$
    – Chuck
    Commented Aug 20, 2015 at 18:28
  • 1
    $\begingroup$ I'm voting to close this question as off-topic because it is not a question about robotics. $\endgroup$
    – Chuck
    Commented Aug 20, 2015 at 19:13
  • 1
    $\begingroup$ Not necessarily that hard. If you have a static background all you really need to do is detect movement with BackgroundSubtractorMOG2 and those moving parts are likely animals. If your background is panning, then it is only slightly more complicated. $\endgroup$
    – Octopus
    Commented Aug 20, 2015 at 21:42
  • 1
    $\begingroup$ @K. Weber, I agree with Chuck that in the aggregate sense, it really is an advanced topic. However, if you are looking to do a "smaller" set of it, there are ways to "cheat". Can you give more specifics as to exactly your use case? For example, if you really have video/images of only animals (no humans), you might be able to cheat using some OpenCV libraries that detect faces... but once again it depends on what you really are trying to accomplish. $\endgroup$
    – Aerophilic
    Commented Aug 21, 2015 at 5:16
  • 1
    $\begingroup$ I do think that this is off topic for robotics, but I find it to be a fascinating question. $\endgroup$
    – Octopus
    Commented Aug 21, 2015 at 20:35

1 Answer 1


Given that you are doing a more "constrained" goal, with a "mostly" static background, I would recommend simply doing a "background image subtraction" method. The "hard part" which has come a long way over the last decade is how you deal with shadows, light changes, and foliage moving.

There are tons of resources on this topic, but here is a good one I found after a quick cursory search: http://www.pyimagesearch.com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/

This should get you to a 80% solution for what you want.

If you want to go deeper, and try to identify specific animals, there are two main approaches you can potentially follow. The easy one is Template Matching, the harder one is creating a Bayes Classifier.

In either approach, you would:

  1. Gather a sample set of data (most likely by using the output from above)
  2. Either:
    • Create templates you would match against
    • Train your classifier to identify the animals you would want

A couple of notes:

  • Template matching out of the box is highly scale and orientation dependent. While you can start with basic template matching, you'll probably quickly want to create a Gaussian pyramid. Here is a good reference: https://stackoverflow.com/questions/22480485/image-matching-in-opencv-python
  • Doing Bayesian Classifiers well is hard, and if you just search on Google Scholar, you'll see a tons of papers on the subject. However, it seems to be the "way to go" for high accuracy. Generally you would combine the base classifier with some other machine learning technique (such as a Markov Model). If you do go this route, I would recommend trying to do something "simpler" than trying to find a whole bird. Instead, I would recommend perhaps identifying a simple feature that would "mean" bird/animal, such as locating an "eye" or "beak".

Hope this helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.