forked from luckychess/camera
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (21 loc) · 655 Bytes
/
main.cpp
File metadata and controls
27 lines (21 loc) · 655 Bytes
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
#include "test_camera.hpp"
#include <iostream>
#include <memory>
double average_frame( const Frame & frame) {
double av = 0.0;
for (int i = 0; i < frame.height(); ++i) {
for (int j = 0; j < frame.width(); ++j) {
av += frame.frame().at(i).at(j);
}
}
return av/(frame.width()*frame.height());
}
int main() {
std::shared_ptr<Camera> camera = std::make_shared<TestCamera>(TestCamera(10, Roi(640, 480, 0, 0), 0.0, 0.0));
auto frame = camera->getFrame();
std::cout << average_frame(frame) << std::endl;
camera->setExposure(20);
frame = camera->getFrame();
std::cout << average_frame(frame) << std::endl;
return 0;
}