Ask Your Question
0

I tried to use function BackgroundSubstractorMOG2, but it didn't work

asked 2016-12-03 03:18:22 -0600

Ruby_Sheng gravatar image

updated 2016-12-03 03:28:21 -0600

berak gravatar image

this is my code:

 Ptr<BackgroundSubtractorMOG2>cv::createBackgroundSubtractorMOG2
  (int history = 500, double varThreshold=16, bool detectShadows=true);

but the system showed that

 error C2572: “cv::createBackgroundSubtractorMOG2”:

I don't know how to fix it

thanks

edit retag flag offensive close merge delete

Comments

which opencv version are you trying to use ?

berak gravatar imageberak ( 2016-12-03 03:25:49 -0600 )edit

it's opencv310

Ruby_Sheng gravatar imageRuby_Sheng ( 2016-12-03 03:45:52 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2016-12-03 04:00:00 -0600

berak gravatar image

updated 2016-12-03 04:04:20 -0600

error C2572 is: "redefinition of default parameter"

so, you have to call it like:

Ptr<BackgroundSubtractorMOG2> subtractor = cv::createBackgroundSubtractorMOG2(500, 16, true);
subtractor->apply(image, mask);

(whithout the varnames, what you've pasted there, is the function's declaration, not a call)

((it's probably time, to grab your c++ book, again...))

edit flag offensive delete link more

Comments

Thank you very much~

Ruby_Sheng gravatar imageRuby_Sheng ( 2016-12-03 04:26:40 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-12-03 03:18:22 -0600

Seen: 276 times

Last updated: Dec 03 '16