ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ReconstructionStatsWidget.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include "base/reconstruction.h"
11 
12 namespace cloudViewer {
13 
15  : QWidget(parent) {
16  setWindowFlags(Qt::Window);
17  resize(parent->width() - 20, parent->height() - 20);
18  setWindowTitle("Reconstruction statistics");
19 
20  stats_table_ = new QTableWidget(this);
21  stats_table_->setColumnCount(2);
22  stats_table_->horizontalHeader()->setVisible(false);
23  stats_table_->verticalHeader()->setVisible(false);
24  stats_table_->horizontalHeader()->setSectionResizeMode(
25  QHeaderView::Stretch);
26 
27  QGridLayout* grid = new QGridLayout(this);
28  grid->addWidget(stats_table_);
29 }
30 
32  const colmap::Reconstruction& reconstruction) {
33  QString stats;
34 
35  stats_table_->clearContents();
36  stats_table_->setRowCount(0);
37 
38  AddStatistic("Cameras", QString::number(reconstruction.NumCameras()));
39  AddStatistic("Images", QString::number(reconstruction.NumImages()));
40  AddStatistic("Registered images",
41  QString::number(reconstruction.NumRegImages()));
42  AddStatistic("Points", QString::number(reconstruction.NumPoints3D()));
43  AddStatistic("Observations",
44  QString::number(reconstruction.ComputeNumObservations()));
45  AddStatistic("Mean track length",
46  QString::number(reconstruction.ComputeMeanTrackLength()));
47  AddStatistic("Mean observations per image",
48  QString::number(
49  reconstruction.ComputeMeanObservationsPerRegImage()));
50  AddStatistic(
51  "Mean reprojection error",
52  QString::number(reconstruction.ComputeMeanReprojectionError()));
53 }
54 
55 void ReconstructionStatsWidget::AddStatistic(const QString& header,
56  const QString& content) {
57  const int row = stats_table_->rowCount();
58  stats_table_->insertRow(row);
59  stats_table_->setItem(row, 0, new QTableWidgetItem(header));
60  stats_table_->setItem(row, 1, new QTableWidgetItem(content));
61 }
62 
63 } // namespace cloudViewer
void Show(const colmap::Reconstruction &reconstruction)
Generic file read and write utility for python interface.
struct Window Window
Definition: sqlite3.c:14678