clean and easy to read, but this kind of operation may generate two temporary objects
foreground_current = (frame_current_ - (1 - Beta_) * background_current_) / Beta_; //#1
Hard to read and verbose
//can't alter the value of background_current
background_current_.copyTo(temp_);
temp_ *= 1 - Beta_; //can't use (Beta_ - 1) since it is negative
frame_current_.copyTo(foreground_current_);
foreground_current_ -= temp_;
foreground_mask_ /= Beta_;
What I want to ask is, do openCV provide some optimization for operator overloading? With the help of expression template, it is possible to eliminate the temporary objects of #1 do openCV2 support this kind of optimization?Thanks