派生自 development/c++

pansen
2019-03-07 d3b7bbe7102cd089680a828f5d8f6402c8cf6342
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "VideoChangeScore.h"
 
VideoChangeScore::VideoChangeScore() {
 
}
 
int VideoChangeScore::EvalChange(cv::Mat &image) {
    if (image.empty())return 0;
 
    cv::blur(image, image, cv::Size(16, 9));
    if (backGround.empty()) {
        image.copyTo(backGround);
    } else {
        backGround = image * 0.1 + backGround * 0.9;
    }
    cv::absdiff(image, backGround, change);
    double min, max;
    cv::minMaxLoc(change, &min, &max);
    return max;
}
 
cv::Mat VideoChangeScore::getBackGround() const {
    return backGround;
}
 
cv::Mat VideoChangeScore::getChange() const {
    return change;
}