5

For a project of mine, I'm required to process images differences with OpenCV. The goal is to detect an intrusion in a zone.

To be a little more clear, here are the inputs and outputs:

Inputs:

  • An image of reference
  • A second image from approximately the same point of view (can be an error margin)

Outputs:

  • Detection of new objects in the scene.

Bonus:

  • Recognition of those objects.

For me, the most difficult part of it is to take off small differences (luminosity, camera position margin error, movement of trees...)

I already read a lot about OpenCV image processing (subtraction, erosion, threshold, SIFT, SURF...) and have some good results.

What I would like is a list of steps you think is the best to have a good detection (humans, cars...), and the algorithms to do each step.

Many thanks for your help.

Anders R. Bystrup
  • 15,729
  • 10
  • 59
  • 55
user2039318
  • 201
  • 1
  • 3
  • 6
  • Well, take a look at [Motion](http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome). It doesn't use OpenCV but it works by image subtraction. Source code and executables (linux) are available. – Milo Feb 04 '13 at 17:00

3 Answers3

3

Track-by-Detect, human tracker:

  1. You apply the Hog detector to detect humans.
  2. You draw a respective rectangle as foreground area on the foreground mask.
  3. You pass this mask to "The OpenCV Video Surveillance / Blob Tracker Facility"

You can, now, group the passing humans based on their blob.{x,y} values into public/restricted areas.

LovaBill
  • 5,107
  • 1
  • 24
  • 32
  • Apparently, the OpenCV Video Surveillance link is dead. Here's the latest archive snapshot I could find: https://web.archive.org/web/20130815034611/http://opencv.willowgarage.com/wiki/VideoSurveillance – arr_sea Oct 14 '16 at 19:00
2

I had to deal with this problem the last year. I suggest an adaptive background-foreground estimation algorithm which produced a foreground mask.

On top of that, you add a blob detector and tracker, and then calculate if an intersection takes place between the blobs and your intrusion area.

Opencv comes has samples of all of these within the legacy code. Ofcourse, if you want you can also use your own or other versions of these.

Links: http://opencv.willowgarage.com/wiki/VideoSurveillance http://experienceopencv.blogspot.gr/2011/03/blob-tracking-video-surveillance-demo.html

Menelaos
  • 23,508
  • 18
  • 90
  • 155
  • Apparently, the OpenCV Video Surveillance link is dead. Here's the latest archive snapshot I could find: https://web.archive.org/web/20130815034611/http://opencv.willowgarage.com/wiki/VideoSurveillance – arr_sea Oct 14 '16 at 19:00
0

I would definitely start with a running average background subtraction if the camera is static. Then you can use findContours() to find the intruding object's location and size. If you want to detect humans that are walking around in a scene, I would recommend looking at using the built-in haar classifier:

http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier

where you would just replace the xml with the upperbody classifier.

Radford Parker
  • 731
  • 4
  • 14
  • Thanks for your answer. Unfortunately, the camera is not static at all. Pictures will be taken approximately at the same position but camera will move. Anyway, a first step can consist into adjusting both frame (maybe using a part of SURF algorythm, right?) then I should be able to use your recommandation. Thanks again for your answer. – user2039318 Feb 09 '13 at 10:42