33 #include <opencv2/core/core.hpp>
34 #include <opencv2/imgproc/imgproc.hpp>
37 #include <Image/ByteImage.h>
44 cv::Mat cv_frame(cv::Size(in.width, in.height), CV_8UC3, CV_MAT_CN(CV_8UC3));
45 std::memcpy(cv_frame.data, in.pixels,
static_cast<unsigned int>(in.width * in.height * in.bytesPerPixel));
48 cv::cvtColor(cv_frame, cv_frame, cv::COLOR_RGB2BGR);
57 cv::Mat frame_cpy(in.size(), in.type());
58 cv::cvtColor(in, frame_cpy, cv::COLOR_BGR2RGB);
61 out.Set(in.size().width, in.size().height, ::CByteImage::ImageType::eRGB24);
62 std::memcpy(out.pixels, frame_cpy.data,
static_cast<unsigned int>(in.size().height * in.size().width * in.channels()));
69 std::chrono::time_point<std::chrono::system_clock> tp{ts};
70 time_t time = std::chrono::system_clock::to_time_t(tp);
73 tstruct = *localtime(&time);
76 int time_us = ts.count() % 1000;
77 int time_ms = std::chrono::duration_cast<std::chrono::milliseconds>(ts).count() % 1000;
78 int time_s = tstruct.tm_sec;
79 int time_m = tstruct.tm_min;
80 int time_h = tstruct.tm_hour;
82 int date_d = tstruct.tm_mday;
83 int date_m = tstruct.tm_mon + 1;
84 int date_y = tstruct.tm_year + 1900;
87 ss << std::setw(4) << std::setfill(
'0') << date_y <<
"-";
88 ss << std::setw(2) << std::setfill(
'0') << date_m <<
"-";
89 ss << std::setw(2) << std::setfill(
'0') << date_d <<
"_";
91 ss << std::setw(2) << std::setfill(
'0') << time_h <<
"-";
92 ss << std::setw(2) << std::setfill(
'0') << time_m <<
"-";
93 ss << std::setw(2) << std::setfill(
'0') << time_s <<
"-";
95 ss << std::setw(3) << std::setfill(
'0') << time_ms;
96 ss << std::setw(3) << std::setfill(
'0') << time_us;
105 int us = ts.count() % 1000;
106 int ms = std::chrono::duration_cast<std::chrono::milliseconds>(ts).count() % 1000;
107 int s = std::chrono::duration_cast<std::chrono::seconds>(ts).count();
108 int m = std::chrono::duration_cast<std::chrono::minutes>(ts).count();
109 int h = std::chrono::duration_cast<std::chrono::hours>(ts).count();
111 std::stringstream ss;
112 ss << std::setw(2) << std::setfill(
'0') << h <<
"_";
113 ss << std::setw(2) << std::setfill(
'0') << m <<
"_";
114 ss << std::setw(2) << std::setfill(
'0') <<
s <<
"_";
116 ss << std::setw(3) << std::setfill(
'0') << ms;
117 ss << std::setw(3) << std::setfill(
'0') << us;