1 // Copyright (c) 2018, ETH Zurich and UNC Chapel Hill. 2 // All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // 10 // * Redistributions in binary form must reproduce the above copyright 11 // notice, this list of conditions and the following disclaimer in the 12 // documentation and/or other materials provided with the distribution. 13 // 14 // * Neither the name of ETH Zurich and UNC Chapel Hill nor the names of 15 // its contributors may be used to endorse or promote products derived 16 // from this software without specific prior written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 22 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 // POSSIBILITY OF SUCH DAMAGE. 29 // 30 // Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de) 31 32 #ifndef COLMAP_SRC_UI_MOVIE_GRABBER_WIDGET_H_ 33 #define COLMAP_SRC_UI_MOVIE_GRABBER_WIDGET_H_ 34 35 #include <unordered_map> 36 37 #include <QtCore> 38 #include <QtGui> 39 #include <QtWidgets> 40 41 #include "base/reconstruction.h" 42 43 namespace colmap { 44 45 class ModelViewerWidget; 46 47 class MovieGrabberWidget : public QWidget { 48 public: 49 MovieGrabberWidget(QWidget* parent, ModelViewerWidget* model_viewer_widget); 50 51 // List of views, used to visualize the movie grabber camera path. 52 std::vector<Image> views; 53 54 struct ViewData { 55 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 56 QMatrix4x4 model_view_matrix; 57 float point_size = -1.0f; 58 float image_size = -1.0f; 59 }; 60 61 private: 62 // Add, delete, clear viewpoints. 63 void Add(); 64 void Delete(); 65 void Clear(); 66 67 // Assemble movie from current viewpoints. 68 void Assemble(); 69 70 // Event slot for time modification. 71 void TimeChanged(QTableWidgetItem* item); 72 73 // Event slot for changed selection. 74 void SelectionChanged(const QItemSelection& selected, 75 const QItemSelection& deselected); 76 77 // Update state when viewpoints reordered. 78 void UpdateViews(); 79 80 ModelViewerWidget* model_viewer_widget_; 81 82 QPushButton* assemble_button_; 83 QPushButton* add_button_; 84 QPushButton* delete_button_; 85 QPushButton* clear_button_; 86 QTableWidget* table_; 87 88 QSpinBox* frame_rate_sb_; 89 QCheckBox* smooth_cb_; 90 QDoubleSpinBox* smoothness_sb_; 91 92 EIGEN_STL_UMAP(const QTableWidgetItem*, ViewData) view_data_; 93 }; 94 95 } // namespace colmap 96 97 EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION_CUSTOM( 98 colmap::MovieGrabberWidget::ViewData) 99 100 #endif // COLMAP_SRC_UI_MOVIE_GRABBER_WIDGET_H_ 101