32 #include <opencv2/opencv.hpp>
47 m_png_compression{png_compression}
63 std::filesystem::path snapshotPath(path);
66 ARMARX_CHECK_EXPRESSION(std::filesystem::exists(path.parent_path())) <<
"Cannot take snapshot, path '" + path.parent_path().string() +
"' does ot exist";
68 if (snapshotPath.extension() !=
".png")
70 snapshotPath +=
".png";
73 const int snapshot_compression = 9;
74 std::vector<int> params {cv::IMWRITE_PNG_COMPRESSION, snapshot_compression,
75 cv::IMWRITE_PNG_STRATEGY, cv::IMWRITE_PNG_STRATEGY_RLE};
76 cv::imwrite(snapshotPath.string(), image, params);
86 recordSnapshot(cv_image, path);
94 writeMetadataLine(
"png_compression",
"unsigned int",
std::to_string(m_png_compression));
101 const auto& [sequence_number, frame_name] = writeMetadataFrame(frame, timestamp);
102 const std::filesystem::path path = deriveFramePath(sequence_number, frame_name);
103 std::vector<int> params {cv::IMWRITE_PNG_COMPRESSION,
static_cast<int>(m_png_compression),
104 cv::IMWRITE_PNG_STRATEGY, cv::IMWRITE_PNG_STRATEGY_RLE};
105 cv::imwrite(path.string(), frame, params);