Ask Your Question

MOG background subtraction CPU vs GPU implementation differences.

asked 2013-05-24 08:14:06 -0500

VSR gravatar image

Looking through the files I noticed the following thing.

In the CPU version, in the BackgroundSubtractorMOG class the parameters of the model

Size frameSize;
int frameType;
Mat bgmodel;
int nframes;
int history;
int nmixtures;
double varThreshold;
double backgroundRatio;
double noiseSigma;

are of PROTECTED type. Meaning that if you want to make a modified version of the MOG background subtraction method, you can just extend the class.

On the other hand, in the GPU version MOG_GPU, the parameters of the model

int nmixtures_;

Size frameSize_;
int frameType_;
int nframes_;

GpuMat weight_;
GpuMat variance_;
GpuMat mean_;

GpuMat bgmodelUsedModes_; //keep track of number of modes per pixel

are of PRIVATE type. Making it impossible to make a modified background subtraction method by extending the class. Is this just an oversight, or is there some kind of weird CUDA limitation, that would prevent the methods of the extended class from being able to work on those variables anyways?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-05-24 09:15:21 -0500

Vladislav Vinogradov gravatar image

updated 2013-05-24 09:24:57 -0500

This class is not designed for expandability (it doesn't have virtual methods).

The private members are not the parameters of the model (except nmixtures_). This is auxiliary variables and memory buffers (implementation details).

The parameters of the model is public members:

int history;
float varThreshold;
float backgroundRatio;
float noiseSigma;

The only exception is nmixtures_. It can be set via constructor:

mog = MOG_GPU(nmixtures);
edit flag offensive delete link more


By parameters I also meant the model itself (mean variance weights). In the case of the CPU version you can extend the class and make your own method that uses the protected variables. In the GPU version those are private and any sort of extension is impossible. Are you saying that this is an oversight in the CPU version then?

VSR gravatar imageVSR ( 2013-05-24 09:29:25 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-05-24 08:14:06 -0500

Seen: 366 times

Last updated: May 24 '13