How processing-hungry are opencv backgroundsubtractor mog, mog2 , gmg?

asked 2014-04-10 19:53:07 -0600

synthnassizer gravatar image

Hi all, I am testing in my application opencv's backgroundSubtractors mog, mog2 and gmg. All 3 reduce the FPS of my application ALOT. With mog and mog2 I get around 17 fps and with gmg I fall down to 5!

I have re-examined my code and I know I pass around the images as references. There is 1 deep copy involved when grabbing the image from camera, but other than that I work with pointers.

Are the algorithms THAT power hungry? Note that I run only one subtraction method at a time on CPU (not gpu). The processor is a core i7 though and it seems reasonable to assumd in should be able to cope. Or am I wrong ?

edit retag flag offensive close merge delete

Comments

It all depends on your input resolution of the images. Since BGS algorithms are basically a pixel by pixel processing they do take alot of time. You cannot avoid that! Mixture of Gaussians adds another layer of complexity on top of that by moddeling the background and foreground, so yeah, the reduction in FPS is quite normal!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-11 04:04:17 -0600 )edit

hi there. indeed the camera i use outputs a 1280x960 frame. but I was somehow hoping the core i7 was a fast enough processor. probably I should harness the GPU for the subtractors...

synthnassizer gravatar imagesynthnassizer ( 2014-04-11 16:51:06 -0600 )edit

It is not your processor that is the problem, but basically the sequentiallity of your image processing step. Your image size requires you to perform an operation for 1280 times 960 pixels = 1,228,800 operations. It is perfectly normal that you will not be able to run this at high frame speeds unless you perform huge optimizations.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-14 02:44:33 -0600 )edit