37 #if CV_MAJOR_VERSION >= 4
38 #include <opencv2/videoio/legacy/constants_c.h>
39 #include <opencv2/imgproc/types_c.h>
47 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
49 #include <QGuiApplication>
51 #include <boost/filesystem.hpp>
56 Display(), capturing_(false), first_time_(true)
59 "start capture",
false,
"start capture",
60 this, SLOT(updateStartCapture()));
62 "filename",
"output.avi",
63 "filename",
this, SLOT(updateFileName()));
66 "fps",
this, SLOT(updateFps()));
67 fps_property_->setMin(0.1);
69 "use 3D viewer size",
true,
70 "Use width and height of 3D viewer for output video or set them manually",
71 this, SLOT(updateUse3DViewerSize()));
74 "Width of video in pixels",
this, SLOT(updateWidth()));
77 "Height of video in pixels",
this, SLOT(updateHeight()));
110 ROS_WARN(
"cannot change name wile recording");
115 int exists_check = access(
file_name_.c_str(), F_OK);
116 if (exists_check == 0) {
117 int access_result = access(
file_name_.c_str(), W_OK);
119 if (access_result != 0) {
129 std::string dirname = pathname.parent_path().string();
130 if (dirname.length() == 0) {
134 int directory_access_result = access(dirname.c_str(), W_OK);
135 if (directory_access_result != 0) {
149 ROS_WARN(
"ignore first time capture enabling");
226 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
233 QImage src = screenshot.toImage().convertToFormat(QImage::Format_RGB888);
234 cv::Mat image(src.height(), src.width(), CV_8UC3,
235 (uchar*)src.bits(), src.bytesPerLine());
236 if (image.size().width !=
width_ || image.size().height !=
height_) {
237 cv::resize(image, image, cv::Size(
width_,
height_), 0, 0, cv::INTER_LINEAR);
239 cv::cvtColor(image, image, CV_RGB2BGR);