21 automatic_update(true),
23 model_viewer_widget_(model_viewer_widget),
24 background_color_(1.0f, 1.0f, 1.0f, 1.0f),
25 point3D_colormap_scale_(1),
26 point3D_colormap_min_q_(0.02),
27 point3D_colormap_max_q_(0.98),
30 setWindowFlags(Qt::Widget | Qt::WindowStaysOnTopHint | Qt::Tool);
31 setWindowModality(Qt::NonModal);
32 setWindowTitle(
"Render options");
34 QHBoxLayout* point_size_layout =
new QHBoxLayout();
35 QPushButton* decrease_point_size =
new QPushButton(
"-",
this);
36 connect(decrease_point_size, &QPushButton::released,
this,
37 &RenderOptionsWidget::DecreasePointSize);
38 QPushButton* increase_point_size =
new QPushButton(
"+",
this);
39 connect(increase_point_size, &QPushButton::released,
this,
40 &RenderOptionsWidget::IncreasePointSize);
41 point_size_layout->addWidget(decrease_point_size);
42 point_size_layout->addWidget(increase_point_size);
45 QHBoxLayout* camera_size_layout =
new QHBoxLayout();
46 QPushButton* decrease_camera_size =
new QPushButton(
"-",
this);
47 connect(decrease_camera_size, &QPushButton::released,
this,
48 &RenderOptionsWidget::DecreaseCameraSize);
49 QPushButton* increase_camera_size =
new QPushButton(
"+",
this);
50 connect(increase_camera_size, &QPushButton::released,
this,
51 &RenderOptionsWidget::IncreaseCameraSize);
52 camera_size_layout->addWidget(decrease_camera_size);
53 camera_size_layout->addWidget(increase_camera_size);
58 projection_cb_ =
new QComboBox(
this);
59 projection_cb_->addItem(
"Perspective");
60 projection_cb_->addItem(
"Orthographic");
65 QPushButton* select_background_color =
66 new QPushButton(tr(
"Select color"),
this);
69 connect(select_background_color, &QPushButton::released,
this,
70 [&]() { SelectColor(
"Background color", &background_color_); });
80 point3D_colormap_cb_ =
new QComboBox(
this);
81 point3D_colormap_cb_->addItem(
"Photometric");
82 point3D_colormap_cb_->addItem(
"Error");
83 point3D_colormap_cb_->addItem(
"Track-Length");
84 point3D_colormap_cb_->addItem(
"Ground-Resolution");
98 connect(point3D_colormap_cb_,
99 (
void(QComboBox::*)(
int)) & QComboBox::currentIndexChanged,
this,
100 &RenderOptionsWidget::SelectPointColormap);
104 image_colormap_cb_ =
new QComboBox(
this);
105 image_colormap_cb_->addItem(
"Uniform color");
106 image_colormap_cb_->addItem(
"Images with words in name");
109 select_image_plane_color_ =
new QPushButton(tr(
"Select color"),
this);
110 connect(select_image_plane_color_, &QPushButton::released,
this,
111 [&]() { SelectColor(
"Image plane color", &image_plane_color_); });
114 select_image_frame_color_ =
new QPushButton(tr(
"Select color"),
this);
115 connect(select_image_frame_color_, &QPushButton::released,
this,
116 [&]() { SelectColor(
"Image frame color", &image_frame_color_); });
119 image_colormap_name_filter_layout_ =
new QHBoxLayout();
120 QPushButton* image_colormap_add_word =
new QPushButton(
"Add",
this);
121 connect(image_colormap_add_word, &QPushButton::released,
this,
122 &RenderOptionsWidget::ImageColormapNameFilterAddWord);
123 QPushButton* image_colormap_clear_words =
new QPushButton(
"Clear",
this);
124 connect(image_colormap_clear_words, &QPushButton::released,
this,
125 &RenderOptionsWidget::ImageColormapNameFilterClearWords);
126 image_colormap_name_filter_layout_->addWidget(image_colormap_add_word);
127 image_colormap_name_filter_layout_->addWidget(image_colormap_clear_words);
128 AddLayoutRow(
"Words", image_colormap_name_filter_layout_);
130 HideLayout(image_colormap_name_filter_layout_);
131 connect(image_colormap_cb_,
132 (
void(QComboBox::*)(
int)) & QComboBox::currentIndexChanged,
this,
133 &RenderOptionsWidget::SelectImageColormap);
138 "Adaptive refresh rate");
147 QPushButton* apply =
new QPushButton(tr(
"Apply"),
this);
149 connect(apply, &QPushButton::released,
this, &RenderOptionsWidget::Apply);
152 void RenderOptionsWidget::closeEvent(QCloseEvent*
event) {
156 void RenderOptionsWidget::Apply() {
162 ApplyPointColormap();
163 ApplyImageColormap();
164 ApplyBackgroundColor();
169 void RenderOptionsWidget::ApplyProjection() {
170 switch (projection_cb_->currentIndex()) {
172 options_->
render->projection_type =
173 colmap::RenderOptions::ProjectionType::PERSPECTIVE;
176 options_->
render->projection_type =
177 colmap::RenderOptions::ProjectionType::ORTHOGRAPHIC;
180 options_->
render->projection_type =
181 colmap::RenderOptions::ProjectionType::PERSPECTIVE;
184 if (options_->
render->projection_type ==
185 colmap::RenderOptions::ProjectionType::PERSPECTIVE) {
188 if (options_->
render->projection_type ==
189 colmap::RenderOptions::ProjectionType::ORTHOGRAPHIC) {
194 void RenderOptionsWidget::ApplyPointColormap() {
197 switch (point3D_colormap_cb_->currentIndex()) {
215 point3D_color_map->
scale =
static_cast<float>(point3D_colormap_scale_);
216 point3D_color_map->
min_q =
static_cast<float>(point3D_colormap_min_q_);
217 point3D_color_map->
max_q =
static_cast<float>(point3D_colormap_max_q_);
222 void RenderOptionsWidget::ApplyImageColormap() {
225 switch (image_colormap_cb_->currentIndex()) {
229 ->uniform_plane_color = image_plane_color_;
231 ->uniform_frame_color = image_frame_color_;
245 void RenderOptionsWidget::ApplyBackgroundColor() {
247 background_color_(0), background_color_(1), background_color_(2));
250 void RenderOptionsWidget::SelectColor(
const std::string& title,
251 Eigen::Vector4f*
color) {
252 const QColor initial_color(
static_cast<int>(255 * (*
color)(0)),
253 static_cast<int>(255 * (*
color)(1)),
254 static_cast<int>(255 * (*
color)(2)),
255 static_cast<int>(255 * (*
color)(3)));
256 const QColor selected_color =
257 QColorDialog::getColor(initial_color,
this, title.c_str());
258 (*color)(0) = selected_color.red() / 255.0;
259 (*color)(1) = selected_color.green() / 255.0;
260 (*color)(2) = selected_color.blue() / 255.0;
261 (*color)(3) = selected_color.alpha() / 255.0;
264 void RenderOptionsWidget::SelectPointColormap(
const int idx) {
276 void RenderOptionsWidget::SelectImageColormap(
const int idx) {
280 HideLayout(image_colormap_name_filter_layout_);
284 ShowLayout(image_colormap_name_filter_layout_);
288 void RenderOptionsWidget::IncreasePointSize() {
289 const float kDelta = 100;
293 void RenderOptionsWidget::DecreasePointSize() {
294 const float kDelta = -100;
298 void RenderOptionsWidget::IncreaseCameraSize() {
299 const float kDelta = 100;
303 void RenderOptionsWidget::DecreaseCameraSize() {
304 const float kDelta = -100;
308 void RenderOptionsWidget::ImageColormapNameFilterAddWord() {
310 const QString word = QInputDialog::getText(
311 this,
"",
"Word:", QLineEdit::Normal,
"", &word_ok);
312 if (!word_ok || word ==
"") {
317 SelectColor(
"Image plane color", &plane_color);
320 SelectColor(
"Image frame color", &frame_color);
323 plane_color, frame_color);
326 void RenderOptionsWidget::ImageColormapNameFilterClearWords() {
static const Eigen::Vector4f kDefaultPlaneColor
static const Eigen::Vector4f kDefaultFrameColor
void AddColorForWord(const std::string &word, const Eigen::Vector4f &plane_color, const Eigen::Vector4f &frame_color)
std::shared_ptr< RenderOptions > render
Generic file read and write utility for python interface.
colmap::ImageColormapNameFilter ImageColormapNameFilter