ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
reconstruction_stats_widget.cc
Go to the documentation of this file.
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 
33 
34 namespace colmap {
35 
37  : QWidget(parent) {
38  setWindowFlags(Qt::Window);
39  resize(parent->width() - 20, parent->height() - 20);
40  setWindowTitle("Reconstruction statistics");
41 
42  stats_table_ = new QTableWidget(this);
43  stats_table_->setColumnCount(2);
44  stats_table_->horizontalHeader()->setVisible(false);
45  stats_table_->verticalHeader()->setVisible(false);
46  stats_table_->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
47 
48  QGridLayout* grid = new QGridLayout(this);
49  grid->addWidget(stats_table_);
50 }
51 
52 void ReconstructionStatsWidget::Show(const Reconstruction& reconstruction) {
53  QString stats;
54 
55  stats_table_->clearContents();
56  stats_table_->setRowCount(0);
57 
58  AddStatistic("Cameras", QString::number(reconstruction.NumCameras()));
59  AddStatistic("Images", QString::number(reconstruction.NumImages()));
60  AddStatistic("Registered images",
61  QString::number(reconstruction.NumRegImages()));
62  AddStatistic("Points", QString::number(reconstruction.NumPoints3D()));
63  AddStatistic("Observations",
64  QString::number(reconstruction.ComputeNumObservations()));
65  AddStatistic("Mean track length",
66  QString::number(reconstruction.ComputeMeanTrackLength()));
67  AddStatistic(
68  "Mean observations per image",
69  QString::number(reconstruction.ComputeMeanObservationsPerRegImage()));
70  AddStatistic("Mean reprojection error",
71  QString::number(reconstruction.ComputeMeanReprojectionError()));
72 }
73 
74 void ReconstructionStatsWidget::AddStatistic(const QString& header,
75  const QString& content) {
76  const int row = stats_table_->rowCount();
77  stats_table_->insertRow(row);
78  stats_table_->setItem(row, 0, new QTableWidgetItem(header));
79  stats_table_->setItem(row, 1, new QTableWidgetItem(content));
80 }
81 
82 } // namespace colmap
void Show(const Reconstruction &reconstruction)
size_t NumImages() const
double ComputeMeanTrackLength() const
size_t NumRegImages() const
size_t ComputeNumObservations() const
size_t NumPoints3D() const
double ComputeMeanReprojectionError() const
double ComputeMeanObservationsPerRegImage() const
size_t NumCameras() const