From c8c1bcafb16330cc96b0c1d4cec13e2bfd93a43c Mon Sep 17 00:00:00 2001 From: DEAR18 Date: Tue, 17 Dec 2024 22:28:44 +0100 Subject: [PATCH] fix the visualized image distortion issue and some other minor issues --- visualizer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/visualizer.cpp b/visualizer.cpp index 2cd0227..8c22977 100644 --- a/visualizer.cpp +++ b/visualizer.cpp @@ -9,6 +9,7 @@ bool Visualizer::Initialize(int iter_num) { pangolin::CreateWindowAndBind("OpenSplat", 1200, 1000); glEnable(GL_DEPTH_TEST); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); cam_state_ = std::make_unique( pangolin::ProjectionMatrix(1200, 1000, 420, 420, 600, 500, 0.1f, 1000), @@ -38,7 +39,7 @@ bool Visualizer::Initialize(int iter_num) { step_ = std::make_unique>("panel.step", 0); init_gaussian_num_ = - std::make_unique>("panel.init gaussian num", 19190); + std::make_unique>("panel.init gaussian num", 0); gaussian_num_ = std::make_unique>("panel.gaussian num", 0); loss_ = std::make_unique>("panel.loss", 0.0f); pause_button_ = @@ -50,6 +51,13 @@ bool Visualizer::Initialize(int iter_num) { void Visualizer::SetLoss(int step, float loss) { loss_log_.Log(loss); + if (loss_viewer_) { + pangolin::XYRangef& range = loss_viewer_->GetView(); + if (loss > range.y.max) { + range.y.max = loss; + } + } + if (loss_) { *loss_ = loss; } @@ -142,6 +150,7 @@ bool Visualizer::DrawImage() { unsigned char* data = concatenated_img.data_ptr(); imageTexture.Upload(data, GL_RGB, GL_UNSIGNED_BYTE); + render_viewer_->SetAspect(static_cast(width) / height); render_viewer_->Activate(); glColor3f(1.0, 1.0, 1.0); imageTexture.RenderToViewport(true);