Ask Your Question

Pickle background subtractor

asked 2013-10-24 12:08:29 -0500

jk89 gravatar image

updated 2013-10-24 12:50:33 -0500

berak gravatar image


I am wondering... is it possible to pickle/serialize/store some how a subtractor object? I have a program which has a mode where it handles one frame and then quits... Seeing that the subtractor I'm using (mog) learn's it would seem like a waste to throw it away on exit. Could it be pickled for future use?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-24 12:49:33 -0500

berak gravatar image

unfortunately, you can't. the trained model is not exposed to the api ( not even in c++ )

edit flag offensive delete link more


I've notice that there is a getbackgroundimage function on some of these subtractors which outputs the background model as an image. However I cannot seem to find a setbackgroundimage function. I guess it is not going to be possible without implementing my own custom subtractor where I have to persist its state myself . Thanks for your answer.

jk89 gravatar imagejk89 ( 2013-10-25 10:06:07 -0500 )edit

getbackgroundimage constructs an image from the background model in a quite expensive process.

berak gravatar imageberak ( 2013-10-25 10:11:43 -0500 )edit

Question Tools


Asked: 2013-10-24 12:08:29 -0500

Seen: 221 times

Last updated: Oct 24 '13