diff --git a/capture.cc b/capture.cc index cb7511e..09a6ffd 100644 --- a/capture.cc +++ b/capture.cc @@ -9,13 +9,14 @@ #include "logc/log.h" #include -capture::capture(int camera_index, int zmq_port, int width_set, int height_set, int fps_set) +capture::capture(int camera_index, int zmq_port, int width_set, int height_set, int fps_set, bool _flip) { index = camera_index; port = zmq_port; width = width_set; height = height_set; fps = fps_set; + flip = _flip; log_info("trying open camera %d", index); @@ -78,7 +79,11 @@ void capture::run(void) { frame = frame.clone().reshape(1, frame.total()); } - + if (flip) + { + cv::flip(frame, frame, -1); + // cv::flip(frame, frame, 1); + } cv::cvtColor(frame, dst, cv::COLOR_BGR2RGB); // cv::imshow(zmq_bind_addr, frame); diff --git a/capture.h b/capture.h index f74f250..61db060 100644 --- a/capture.h +++ b/capture.h @@ -15,14 +15,16 @@ public: int height; int fps; bool status = false; + bool flip = false; char zmq_bind_addr[40] = "tcp://*:"; + std::thread *thread; cv::VideoCapture *cap; cv::Mat frame; zmq::context_t *context; zmq::socket_t *socket; - capture(int camera_index, int zmq_port, int width_set = 320, int height_set = 240, int fps_set = 20); + capture(int camera_index, int zmq_port, int width_set = 320, int height_set = 240, int fps_set = 20, bool flip = false); void start(void); void run(void); bool is_open(void); diff --git a/config.toml b/config.toml index 5c5aa73..dc565e6 100644 --- a/config.toml +++ b/config.toml @@ -1,9 +1,9 @@ [server] -server_0_index = 0 +server_0_index = 6 server_0_port = 5555 -server_1_index = 2 +server_1_index = 7 server_1_port = 5556 server_2_index = 4 diff --git a/main.cc b/main.cc index 9ba506c..d4869ee 100644 --- a/main.cc +++ b/main.cc @@ -47,7 +47,7 @@ int main(int argc, char **argv) toml_datum_t server_2_port = toml_int_in(server, "server_2_port"); capture cap0(server_0_index.u.i, server_0_port.u.i); - capture cap1(server_1_index.u.i, server_1_port.u.i, 320, 240, 25); + capture cap1(server_1_index.u.i, server_1_port.u.i, 320, 240, 60, true); capture cap2(server_2_index.u.i, server_2_port.u.i); cap0.start();