pcd_video_player.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  * 
00004  * Point Cloud Library (PCL) - www.pointclouds.org
00005  * Copyright (c) 2012-, Open Perception, Inc.
00006  * 
00007  * All rights reserved.
00008  * 
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met: 
00012  * 
00013  *  * Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  *  * Redistributions in binary form must reproduce the above
00016  *    copyright notice, this list of conditions and the following
00017  *    disclaimer in the documentation and/or other materials provided
00018  *    with the distribution.
00019  *  * Neither the name of the copyright holder(s) nor the names of its
00020  *    contributors may be used to endorse or promote products derived
00021  *    from this software without specific prior written permission.
00022  * 
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  * POSSIBILITY OF SUCH DAMAGE.
00035  */
00036 
00037 #include <ui_pcd_video_player.h>
00038 
00039 #include <iostream>
00040 #include <time.h>
00041 
00042 // QT4
00043 #include <QMainWindow>
00044 #include <QMutex>
00045 #include <QTimer>
00046 
00047 // Boost
00048 #include <boost/thread/thread.hpp>
00049 #include <boost/filesystem.hpp>
00050 
00051 // PCL
00052 #include <pcl/console/print.h>
00053 #include <pcl/console/parse.h>
00054 
00055 #include <pcl/common/common.h>
00056 #include <pcl/common/angles.h>
00057 #include <pcl/common/time.h>
00058 #include <pcl/common/transforms.h>
00059 
00060 #include <pcl/point_cloud.h>
00061 #include <pcl/point_types.h>
00062 
00063 #include <pcl/io/pcd_grabber.h>
00064 #include <pcl/io/pcd_io.h>
00065 
00066 #include <pcl/visualization/pcl_visualizer.h>
00067 #include <pcl/visualization/point_cloud_handlers.h>
00068 
00069 #include <pcl/registration/transformation_estimation_svd.h>
00070 
00071 #define CURRENT_VERSION 0.2
00072 
00073 // Useful macros
00074 #define FPS_CALC(_WHAT_) \
00075 do \
00076 { \
00077     static unsigned count = 0;\
00078     static double last = pcl::getTime ();\
00079     double now = pcl::getTime (); \
00080     ++count; \
00081     if (now - last >= 1.0) \
00082     { \
00083       std::cout << "Average framerate("<< _WHAT_ << "): " << double(count)/double(now - last) << " Hz" <<  std::endl; \
00084       count = 0; \
00085       last = now; \
00086     } \
00087 }while(false)
00088 
00089 namespace Ui
00090 {
00091   class MainWindow;
00092 }
00093 
00094 class PCDVideoPlayer : public QMainWindow
00095 {
00096   Q_OBJECT
00097   public:
00098     typedef pcl::PointCloud<pcl::PointXYZRGBA> Cloud;
00099     typedef Cloud::Ptr CloudPtr;
00100     typedef Cloud::ConstPtr CloudConstPtr;
00101 
00102     PCDVideoPlayer ();
00103 
00104     ~PCDVideoPlayer () {}
00105 
00106   protected:
00107     boost::shared_ptr<pcl::visualization::PCLVisualizer> vis_;
00108     pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_;
00109 
00110     QMutex mtx_;
00111     QMutex vis_mtx_;
00112     Ui::MainWindow *ui_;
00113     QTimer *vis_timer_;
00114 
00115     QString dir_;
00116 
00117     std::vector<std::string> pcd_files_;
00118     std::vector<boost::filesystem::path> pcd_paths_;
00119 
00120 
00122     unsigned int current_frame_;
00124     unsigned int nr_of_frames_;
00125 
00127     bool cloud_present_;
00129     bool cloud_modified_;
00130 
00132     bool play_mode_;
00134     unsigned int speed_counter_;
00136     unsigned int speed_value_;
00137 
00138   public slots:
00139     void 
00140     playButtonPressed ()
00141     { play_mode_ = true; }
00142 
00143     void 
00144     stopButtonPressed()
00145     { play_mode_ = false; }
00146 
00147     void
00148     backButtonPressed ();
00149 
00150     void
00151     nextButtonPressed ();
00152 
00153     void
00154     selectFolderButtonPressed ();
00155 
00156     void
00157     selectFilesButtonPressed ();
00158 
00159     void
00160     indexSliderValueChanged (int value);
00161 
00162   private slots:
00163     void
00164     timeoutSlot ();
00165 
00166 };


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:28:03