Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 71ced002 authored by bkerbl's avatar bkerbl
Browse files

Automatic iteration lookup, ellipsoid fix

parent 0a1620ac
No related branches found
No related tags found
1 merge request!40core/utils: fix installDirectory method in linux
...@@ -20,6 +20,41 @@ ...@@ -20,6 +20,41 @@
#include <core/raycaster/Raycaster.hpp> #include <core/raycaster/Raycaster.hpp>
#include <core/view/SceneDebugView.hpp> #include <core/view/SceneDebugView.hpp>
#include <algorithm> #include <algorithm>
#include <boost/filesystem.hpp>
#include <regex>
namespace fs = boost::filesystem;
std::string findLargestNumberedSubdirectory(const std::string& directoryPath) {
fs::path dirPath(directoryPath);
if (!fs::exists(dirPath) || !fs::is_directory(dirPath)) {
std::cerr << "Invalid directory: " << directoryPath << std::endl;
return "";
}
std::regex regexPattern(R"_(iteration_(\d+))_");
std::string largestSubdirectory;
int largestNumber = -1;
for (const auto& entry : fs::directory_iterator(dirPath)) {
if (fs::is_directory(entry)) {
std::string subdirectory = entry.path().filename().string();
std::smatch match;
if (std::regex_match(subdirectory, match, regexPattern)) {
int number = std::stoi(match[1]);
if (number > largestNumber) {
largestNumber = number;
largestSubdirectory = subdirectory;
}
}
}
}
return largestSubdirectory;
}
#define PROGRAM_NAME "sibr_3Dgaussian" #define PROGRAM_NAME "sibr_3Dgaussian"
using namespace sibr; using namespace sibr;
...@@ -92,7 +127,15 @@ int main(int ac, char** av) ...@@ -92,7 +127,15 @@ int main(int ac, char** av)
std::string plyfile = myArgs.modelPath.get(); std::string plyfile = myArgs.modelPath.get();
if (plyfile.back() != '/') if (plyfile.back() != '/')
plyfile += "/"; plyfile += "/";
plyfile += "point_cloud/iteration_" + std::to_string(myArgs.iteration.get()) + "/point_cloud.ply"; plyfile += "point_cloud";
if (!myArgs.iteration.isInit())
{
plyfile += "/" + findLargestNumberedSubdirectory(plyfile) + "/point_cloud.ply";
}
else
{
plyfile += "/iteration_" + myArgs.iteration.get() + " / point_cloud.ply";
}
// Setup the scene: load the proxy, create the texture arrays. // Setup the scene: load the proxy, create the texture arrays.
const uint flags = SIBR_GPU_LINEAR_SAMPLING | SIBR_FLIP_TEXTURE; const uint flags = SIBR_GPU_LINEAR_SAMPLING | SIBR_FLIP_TEXTURE;
......
...@@ -43,7 +43,7 @@ namespace sibr { ...@@ -43,7 +43,7 @@ namespace sibr {
struct GaussianAppArgs : struct GaussianAppArgs :
virtual BasicIBRAppArgs { virtual BasicIBRAppArgs {
RequiredArg<std::string> modelPath = { "model-path", "Model directory" }; RequiredArg<std::string> modelPath = { "model-path", "Model directory" };
Arg<int> iteration = { "iteration", 30000, "Iteration to load from model" }; RequiredArg<std::string> iteration = { "iteration", "Iteration to load from model" };
Arg<bool> loadImages = { "load_images", "Whether or not to load images for scene overview"}; Arg<bool> loadImages = { "load_images", "Whether or not to load images for scene overview"};
}; };
......
...@@ -316,7 +316,7 @@ void sibr::GaussianView::onRenderIBR(sibr::IRenderTarget & dst, const sibr::Came ...@@ -316,7 +316,7 @@ void sibr::GaussianView::onRenderIBR(sibr::IRenderTarget & dst, const sibr::Came
{ {
_gaussianRenderer->process(count, *gData, eye, dst, 0.2f); _gaussianRenderer->process(count, *gData, eye, dst, 0.2f);
} }
else if (currMode == "SfM Points") else if (currMode == "Initial Points")
{ {
_pointbasedrenderer->process(_scene->proxies()->proxy(), eye, dst); _pointbasedrenderer->process(_scene->proxies()->proxy(), eye, dst);
} }
...@@ -390,8 +390,8 @@ void sibr::GaussianView::onGUI() ...@@ -390,8 +390,8 @@ void sibr::GaussianView::onGUI()
{ {
if (ImGui::Selectable("Splats")) if (ImGui::Selectable("Splats"))
currMode = "Splats"; currMode = "Splats";
if (ImGui::Selectable("SfM Points")) if (ImGui::Selectable("Initial Points"))
currMode = "SfM Points"; currMode = "Initial Points";
if (ImGui::Selectable("Ellipsoids")) if (ImGui::Selectable("Ellipsoids"))
currMode = "Ellipsoids"; currMode = "Ellipsoids";
ImGui::EndCombo(); ImGui::EndCombo();
......
...@@ -89,10 +89,10 @@ void main() { ...@@ -89,10 +89,10 @@ void main() {
float a = alphas[boxID]; float a = alphas[boxID];
alphaVert = a; alphaVert = a;
ellipsoidScale = vec3(scales[3 * boxID + 0], scales[3 * boxID + 1], scales[3 * boxID + 2]); ellipsoidScale = vec3(scales[3 * boxID + 0], scales[3 * boxID + 1], scales[3 * boxID + 2]);
ellipsoidScale = 2 * exp(ellipsoidScale); ellipsoidScale = 2 * ellipsoidScale;
vec4 q = rots[boxID]; vec4 q = rots[boxID];
ellipsoidRotation = transpose(quatToMat3(q / length(q))); ellipsoidRotation = transpose(quatToMat3(q));
int vertexIndex = boxIndices[gl_VertexID]; int vertexIndex = boxIndices[gl_VertexID];
worldPos = ellipsoidRotation * (ellipsoidScale * boxVertices[vertexIndex]); worldPos = ellipsoidRotation * (ellipsoidScale * boxVertices[vertexIndex]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment