Opencv Motion Detection with Tracking

I need reliable motion detection and tracking in webcam camcorders. The background is always the same. The goal is to determine the position of the object, if possible, without shadows, but not so urgently remove the shadows. I tried the opencv algorithm to subtract the background and the threshold value, but it depends on only one image as the background, that if the background changes a little in brightness (or camera autofocus), I need an algorithm that will be strong for small changes like brightness or some the shadows.

+5
source share
3 answers

A reliable tracking method is part of the broad research interests that are being developed around the world ... Here, maybe the keys to solving your problem are very interesting, but wide and open.

At first, many of them assume a constant brightness (therefore, what you ask for is difficult to achieve). For instance:

  • Lucas-kanade
  • Horn-shunk
  • Matching block

widely used for tracking, but implies a constant brightness.

Then other means of tracking movement or movement may be interesting, but you need a projection to follow ... However, you can use a reverse projection calculated according to a certain threshold to meet your reliability needs ...

I will talk about this later, Julien,

+3
source

OpenCV, RGB (, , ) HSV (, , )? , HSV OpenCV cvBlobsLib blob.

HSV , HSV , ( "" ), : . ( "" "" ).

( "imgHSV" ), (-) cvInRange() OpenCV API:

cvInRangeS( imgHSV,  
            cvScalar( 104, 178, 70  ),  
            cvScalar( 130, 240, 124 ),  
            imgThresh ); 

cvScalar HSV, . max/min, (), //, .

.

+3

Andrian http://www.pyimagesearch.com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/

I followed this up and tested a good experiment https://youtu.be/HJBOOZVefXA

I also use static image

frameDelta = cv2.absdiff(firstFrame, gray)
thresh = cv2.threshold(frameDelta, 25, 255, cv2.THRESH_BINARY)[1]
thresh = cv2.dilate(thresh, None, iterations=2)
(cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)

4 lines of code find good luck traffic

+1
source

All Articles