Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cv::Mat calculatedBackground;
- cv::Mat getForegroundMask( cv::Mat sourceImage8 )
- {
- // Remove NODEPTH because it is at maximum distance
- cv::Mat foregroundMask;
- cv::Mat frame8withoutNODEPTH;
- cv::threshold( sourceImage8, frame8withoutNODEPTH, 250,250, cv::THRESH_TOZERO_INV );
- // Compare for new maximum distances
- cv::max( calculatedBackground, frame8withoutNODEPTH, calculatedBackground );
- // Add small Tolerance
- cv::Mat backgroundWithTolerance;
- cv::add( calculatedBackground, cvScalarAll(-1), backgroundWithTolerance );
- // Find foreground:
- cv::compare( sourceImage8, backgroundWithTolerance, foregroundMask, cv::CMP_LT );
- return foregroundMask;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement