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);
71 out.Set(in.size().width, in.size().height, ::CByteImage::ImageType::eRGB24);
72 std::memcpy(out.pixels, in.data,
static_cast<unsigned int>(in.size().height * in.size().width * in.channels()));
79 std::chrono::time_point<std::chrono::system_clock> tp{ts};
80 time_t time = std::chrono::system_clock::to_time_t(tp);
83 tstruct = *localtime(&time);
86 int time_us = ts.count() % 1000;
87 int time_ms = std::chrono::duration_cast<std::chrono::milliseconds>(ts).count() % 1000;
88 int time_s = tstruct.tm_sec;
89 int time_m = tstruct.tm_min;
90 int time_h = tstruct.tm_hour;
92 int date_d = tstruct.tm_mday;
93 int date_m = tstruct.tm_mon + 1;
94 int date_y = tstruct.tm_year + 1900;
97 ss << std::setw(4) << std::setfill(
'0') << date_y <<
"-";
98 ss << std::setw(2) << std::setfill(
'0') << date_m <<
"-";
99 ss << std::setw(2) << std::setfill(
'0') << date_d <<
"_";
101 ss << std::setw(2) << std::setfill(
'0') << time_h <<
"-";
102 ss << std::setw(2) << std::setfill(
'0') << time_m <<
"-";
103 ss << std::setw(2) << std::setfill(
'0') << time_s <<
"-";
105 ss << std::setw(3) << std::setfill(
'0') << time_ms;
106 ss << std::setw(3) << std::setfill(
'0') << time_us;
115 int us = ts.count() % 1000;
116 int ms = std::chrono::duration_cast<std::chrono::milliseconds>(ts).count() % 1000;
117 int s = std::chrono::duration_cast<std::chrono::seconds>(ts).count();
118 int m = std::chrono::duration_cast<std::chrono::minutes>(ts).count();
119 int h = std::chrono::duration_cast<std::chrono::hours>(ts).count();
121 std::stringstream ss;
122 ss << std::setw(2) << std::setfill(
'0') << h <<
"_";
123 ss << std::setw(2) << std::setfill(
'0') << m <<
"_";
124 ss << std::setw(2) << std::setfill(
'0') <<
s <<
"_";
126 ss << std::setw(3) << std::setfill(
'0') << ms;
127 ss << std::setw(3) << std::setfill(
'0') << us;