-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLexp.cpp
51 lines (47 loc) · 1.14 KB
/
Lexp.cpp
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <opencv2\core.hpp>
#include <opencv2\highgui.hpp>
#include <iomanip>
#include <string>
#include <iostream>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
using namespace std;
using namespace cv;
struct RunOnce {
template<typename T> RunOnce(T &&f) { f(); }
};
int main() {
Mat current, result, dst;
unsigned int i = 1;
bool frames = !false;
if (frames) {
std::string path = "ss";
for (auto & p : fs::directory_iterator(path)) {
static RunOnce a([&]() {stringstream ss; ss << p; result = imread(ss.str()); });
double val = 1.0 / (i);
stringstream ss; ss << p;
cout << p << endl;
current = imread(ss.str());
addWeighted(current, val, result, 1 - val, 0, result);
imshow("lol", result);
waitKey(60);
i++;
}
}
else {
VideoCapture cap("video.avi");
if (!cap.isOpened())
return -1;
while (cap.read(current)) {
static RunOnce a([&]() {current.copyTo(result); });
double val = 1.0 / (i);
addWeighted(current, val, result, 1 - val, 0, result);
imshow("lol", result);
waitKey(60);
i++;
}
}
imwrite("resultado.jpg", result);
waitKey(0);
}