Questions tagged [background-subtraction]

Background-subtraction is a Computer-Vision technique that given a frame sequence from a fixed camera, processes pixels and separates them into foreground and background pixels.

Background Subtraction is a type of image segmentation which goal is to separate the parts of the image that are invariant over time (background) from the objects that are moving or changing (foreground).

The simplest techniques use frame differencing and more advanced techniques require using statistical methods. For example, a moving leaf of a tree would be considered foreground using simple frame differencing but with a proper statistical method it can be considered background as the leaf is always there, moving periodically.

Methods:

  • Frame differencing
  • Background as the average or the median of the previous nframes.
  • Background as the running average.
  • Pfinder (one Gaussian)
  • Mixture of K Gaussians
290 questions
1
vote
1 answer

black on black motion segmentation in Matlab

I have a video that I am using background subtraction and motion segmentation on. The floor in the video is black, so when I get the silhouette the feet and parts of the legs are cut off. Is there a fix around this? This is what it looks like. …
oldbutnew
  • 145
  • 1
  • 13
1
vote
1 answer

subtraction frames opencv

hey i tried to do subtraction between current frame to previous, (the code attached ) the code running but i get errors and gray window without result the errors i got on command prompt: Compiler did not align stack variables. Libavcodec has been…
Ilan Reuven
  • 61
  • 2
  • 3
  • 6
0
votes
1 answer

Background subtraction in c#

I'm studying a background subtraction technique. I came to know that using the initialized library Emgucv can provide me with what I want. I want to get the output of a moving object. the object that moves should be in white colour and the rest of…
S. Vikneshwar
  • 71
  • 1
  • 1
  • 13
0
votes
1 answer

OPENCV Weird Error

I am using Background Subtraction and want to display the contents. Somehow the code seems to break all the time due to a memory exception. The error seems to be in cvCopy function. Can't figure it out. #include "cv.h" #include "highgui.h" #include…
0
votes
0 answers

OpenCV BackgroundSubtractorMOG2 seems to return false-positive pixels

I have the following code with which, I am trying to detect movements (ideally with adjustable threshold) in specific regions of a video (roi_masks). I am just doing something fatally wrong, because it returns false positive detections sometimes…
peter
  • 4,289
  • 12
  • 44
  • 67
0
votes
1 answer

getting key error on running trackpy on background subtracted video

I am new to python programing. I am using background subtraction on avi video file followed by tracking the cells in image using trackpy When i run the code it gives the error: raise KeyError(key) from err KeyError: 'frame' my code is import…
0
votes
1 answer

suggest appropiate background substraction method

I am performing outer edge detection for droplets of this image.The problem is that the image is having uneven illumination.Hence background substraction is not working properly.please help.Thanks Frame= cv2.rotate(Frame,…
0
votes
0 answers

KLT-Tracker: How to avoid losing detected person on recalibration

Reading from the ground truth, I have an initial bounding box. I then calculate a foreground mask and use cv2.goodFeaturesToTrack to get points I can follow using cv2.calcOpticalFlowPyrLK. I calculate the bounding box by taking the largest possible…
Natan
  • 728
  • 1
  • 7
  • 23
0
votes
1 answer

Remove moving objects with OpenCV calculating the mode using Python

this code works great in order to substract moving objects. The input is an mp4 video and the output is the background without any moving object. The problem is, this code is calculating the MEDIAN of every pixel. Is there any way to calculate the…
JN1997
  • 119
  • 7
0
votes
1 answer

Why am I getting "cv2.error: Unknown C++ exception from OpenCV code" when I'm using cv2.BackgroundSubtractorKNN() in Python?

A simple program to show the feed from my webcam is running fine. I'm getting the error only when I try to run cv2.BackgroundSubtractorKNN() within the loop. I have applied the following fix: Uninstalled the latest version of OpenCV (which I was…
A7sus4
  • 11
  • 3
0
votes
0 answers

Getting background after removing foreground in OpenCV background subtraction

I am using background subtraction, in particular MOG2 for video bgs with OpenCV. I am currently getting the original frame and the foreground mask in two seperate opencv windows. I want to get a display of the background with the foreground removed.…
0
votes
1 answer

OpenCV BackgroundSubtractorMOG2 algorithm crashes when executed as part of my Swift UI app

I'm creating a Swift UI application to process images on a device and use the OpenCV library, specifically the BackgroundSubtractor algorithm. I was able to follow the OpenCV iOS guide and perform basic image operations, like take an image, convert…
Mando
  • 11,414
  • 17
  • 86
  • 167
0
votes
1 answer

Background Subtraction – Stauffer & Grimson’s Algorithm in opencv's latest versions

There is an implementation of that algorithm in opencv version 1.0 the function is cvCreateFGDStatModel to create the background model. But I can't find it in latest versions. Does anybody knows if it was removed or renamed? And if you know other…
maximus
  • 4,201
  • 15
  • 64
  • 117
0
votes
1 answer

How to calculate pixel number of foreground area in background subtraction

I have created a segmentation using the background subtraction technique. The next step I want to do is to eliminate the foreground area that has a number of pixels < 20. the question is how to count the number of pixels in each foreground area in a…
0
votes
2 answers

Python element-wise condition on numpy ndarray

I have two numpy ndarrays of the same shape. A = [[12, 25, 6], [28, 52, 74]] B = [[100, 2, 4], [2, 12, 14]] My goal is to replace every element where there the value in B is <= 5 by 0 in A. So my result should be : # So C[0][0] = 12 because…