diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-13 07:07:16 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-13 07:07:16 +0200 |
commit | c1503fe8eda914541415ece61e53001060c6e5ae (patch) | |
tree | aa40ef19c4ee149063231c471bd23ee18a15706a /ftnoir_tracker_pt | |
parent | f19017548381ab1dabc11e312acc790253d8b07d (diff) |
reformat only
Diffstat (limited to 'ftnoir_tracker_pt')
-rw-r--r-- | ftnoir_tracker_pt/camera.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index eaf51e17..9168a3e4 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -16,39 +16,39 @@ using namespace cv; // ---------------------------------------------------------------------------- void get_camera_device_names(std::vector<std::string>& device_names) { - videoInput VI; - VI.listDevices(); - std::string device_name; - for(int index = 0; ; ++index) { - device_name = VI.getDeviceName(index); - if (device_name.empty()) break; - device_names.push_back(device_name); - } + videoInput VI; + VI.listDevices(); + std::string device_name; + for(int index = 0; ; ++index) { + device_name = VI.getDeviceName(index); + if (device_name.empty()) break; + device_names.push_back(device_name); + } } #endif // ---------------------------------------------------------------------------- void Camera::set_device_index(int index) { - if (desired_index != index) - { - desired_index = index; - _set_device_index(); + if (desired_index != index) + { + desired_index = index; + _set_device_index(); - // reset fps - dt_valid = 0; - dt_mean = 0; - active_index = index; - } + // reset fps + dt_valid = 0; + dt_mean = 0; + active_index = index; + } } void Camera::set_fps(int fps) { - if (cam_desired.fps != fps) - { - cam_desired.fps = fps; - _set_fps(); - } + if (cam_desired.fps != fps) + { + cam_desired.fps = fps; + _set_fps(); + } } void Camera::set_res(int x_res, int y_res) @@ -63,17 +63,17 @@ void Camera::set_res(int x_res, int y_res) bool Camera::get_frame(float dt, cv::Mat* frame) { - bool new_frame = _get_frame(frame); - // measure fps of valid frames - const float dt_smoothing_const = 0.9; - dt_valid += dt; - if (new_frame) - { - dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid; - cam_info.fps = dt_mean > 1e-3 ? 1.0 / dt_mean : 0; - dt_valid = 0; - } - return new_frame; + bool new_frame = _get_frame(frame); + // measure fps of valid frames + const float dt_smoothing_const = 0.9; + dt_valid += dt; + if (new_frame) + { + dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid; + cam_info.fps = dt_mean > 1e-3 ? 1.0 / dt_mean : 0; + dt_valid = 0; + } + return new_frame; } void CVCamera::start() @@ -118,10 +118,10 @@ bool CVCamera::_get_frame(Mat* frame) if (img.empty()) return false; - *frame = img; - cam_info.res_x = img.cols; - cam_info.res_y = img.rows; - return true; + *frame = img; + cam_info.res_x = img.cols; + cam_info.res_y = img.rows; + return true; } return false; } |