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",
62 "filename",
"output.avi",
69 "use 3D viewer size",
true,
70 "Use width and height of 3D viewer for output video or set them manually",
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) {
133 ROS_INFO(
"dirname: %s", dirname.c_str());
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");
219 ROS_WARN(
"force to disable capturing");
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);
virtual void onInitialize()
void updateUse3DViewerSize()
PLUGINLIB_EXPORT_CLASS(jsk_rviz_plugins::PictogramArrayDisplay, rviz::Display)
DisplayContext * context_
rviz::IntProperty * height_property_
virtual ViewManager * getViewManager() const =0
virtual int getInt() const
rviz::BoolProperty * use_3d_viewer_size_property_
virtual float getFloat() const
virtual void startCapture()
virtual void update(float wall_dt, float ros_dt)
virtual ~VideoCaptureDisplay()
void updateStartCapture()
std::string getStdString()
rviz::StringProperty * file_name_property_
rviz::IntProperty * width_property_
virtual bool getBool() const
rviz::BoolProperty * start_capture_property_
virtual void stopCapture()
virtual void queueRender()=0
rviz::FloatProperty * fps_property_
RenderPanel * getRenderPanel() const
bool setStdString(const std::string &std_str)
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)