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
3
votes
2 answers

Median variance in background subtraction

I am facing some issues in implementation of the paper Statistical Background Subtraction for a Mobile Observer. Question 1: In Section 4.1, it talks about "... the median variance is computed over the entire image from the first components ..." I…
3
votes
1 answer

How to remove the background of an image using OpenCV?

What would be the best way to remove the background from this photo? I've tried converted to HSV and using inRange to get a mask, but it doesn't pick up the plant fully, and includes some of the mortar between the brickwork.
3
votes
0 answers

Adaptive background subtraction with motionless objects in processing

I would like to get a background subtraction method for outdoor conditions, capable of gradually adjust itself to environment light variations but with the capacity of revealing a presence even that is not in motion. The problem with adaptive opencv…
3
votes
0 answers

Is there a way to export/checkpoint OpenCV Background Subtraction for later use?

Is there a way to export/checkpoint OpenCV Background Subtraction for later use? I have some very long video files to process which require background removal. I would like to cut the video into small chunks and process each chunk separately. …
3
votes
2 answers

OpenCV 'BackgroundSubtractorMOG2' for two images

I am trying to highlight differences between two almost similar image masks using OpenCV's BackgroundSubtractorMOG2 method. My Code: def Approach_2(): img = [0, 0] img[0] = cv2.imread('images/4-left.PNG', cv2.IMREAD_GRAYSCALE) img[1] =…
3
votes
0 answers

Error (-209) The operation is neither 'array op array' --- How to resolve this issue?

I'm trying to do background subtraction using OpenCV trying to subtract two images from each other. One of the images is the background image and is fed to the program statically while the second image is taken from the webcam connected to the…
3
votes
1 answer

How to detect moving object in varying light(illumination) conditions due to clouds - openCV

I have been trying to detect moving vehicles. But due to varying light conditions because of clouds, (not shadows of clouds, just illuminations) the background subtraction fails. I have uploaded my input video here --> Youtube (30secs) Here is what…
Severus Tux
  • 265
  • 3
  • 13
3
votes
1 answer

Any tutorial/ good documentation on how to use the Mixture of Gaussians opencv implementation?

I have found OpenCV code that uses CvGaussBGStatModelParams structure, cvCreateGaussianBGModel, and other related functions. However, I haven't been able to find any explanations for how they work and how they are to be used and what they mean. Any…
3
votes
0 answers

Background subtraction using median in time

I need to perform background subtraction in matlab. I have a short video of a man crossing over a wall from right to left, so it is a simple and quite stable video. I learned about a method to estimate the background using median in time: we need to…
3
votes
1 answer

OpenCV Foreground Detection slow

I am trying to implement the codebook foreground detection algorithm outlined here in the book Learning OpenCV. The algorithm only describes a codebook based approach for each pixel of the picture. So I took the simplest approach that came to mind -…
3
votes
1 answer

Opencv background subtraction do not detect moving objects for video with light snow showers

I am trying to use opencv background subtraction for detecting moving objects. It works good for some videos. But for one particular video (captured by still camera), it do not detect moving pedestrians. Also, there is very light snow showers in the…
3
votes
1 answer

Processing 3 : using background subtraction, video not playing

I am trying to run simple processing program in eclipse to play video. this is the code: import processing.core.*; import processing.video.*; public class BackgroundSubtraction extends PApplet { Movie video; public void setup(){ size(720,480); …
3
votes
0 answers

BackgroundSubtractor throws 'Unrecognized or unsupported array type in function cvGetMat' Exception

I have searched a lot for this problem, but I did not find any solution. I have a program which receives JPEG format file data through socket (in bytes), then I convert the byte array to OpenCV Mat object as below: Mat mat = Imgcodecs.imdecode(new…
Bahramdun Adil
  • 5,907
  • 7
  • 35
  • 68
3
votes
1 answer

OpenCV Background Substraction c++

I've create a background Subsctractor (MOG) and now, I want to change some parameters: Ptr< BackgroundSubtractor> pMOG, pMOG2; pMOG = new BackgroundSubtractorMOG(); pMOG.set("varThreshold",5); //does't work pMOG->operator()(inputImage, outputImage);…
black
  • 1,151
  • 3
  • 18
  • 46
3
votes
2 answers

how to detect moving object in live video camera using openCV

i am using openCV for my ios application to detect moving object in live video camera, but i am not familiar with use of openCV please help me. any other way to do this also welcome . - (void)viewDidLoad { [super viewDidLoad]; …
bLacK hoLE
  • 781
  • 1
  • 7
  • 20