diff --git a/apps/harmonized_ulr_app/CMakeLists.txt b/apps/harmonized_ulr_app/CMakeLists.txt index 0a0c11b140c2833999e540d28943c550cf73e643..033aa513a520aaf0506141f50da0437929d8d5d3 100644 --- a/apps/harmonized_ulr_app/CMakeLists.txt +++ b/apps/harmonized_ulr_app/CMakeLists.txt @@ -27,13 +27,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/apps/hybrid_compare_app/main.cpp b/apps/hybrid_compare_app/main.cpp index dd98acbfb93f3f651f959bcb997963716e2490d7..6e2b1aa49ba1c2407b98bb75332a6b0b5a159d21 100644 --- a/apps/hybrid_compare_app/main.cpp +++ b/apps/hybrid_compare_app/main.cpp @@ -1,7 +1,7 @@ #include <fstream> -#include "projects/deep_blending/renderer/DeepBlendingView.hpp" +#include "projects/inside_out_deep_blending/renderer/DeepBlendingView.hpp" #include "projects/color_harmonize/renderer/HybridView.hpp" #include "projects/color_harmonize/renderer/PerViewMeshDebugView.hpp" #include <core/graphics/Window.hpp> diff --git a/apps/hybrid_render_app/CMakeLists.txt b/apps/hybrid_render_app/CMakeLists.txt index 3ea8549547c6790edfea6ba0c6ef74a87a8c15b6..7558b414324d2cd3a396afeb25c675c83ab1f16d 100644 --- a/apps/hybrid_render_app/CMakeLists.txt +++ b/apps/hybrid_render_app/CMakeLists.txt @@ -44,13 +44,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/apps/hybrid_render_app/main.cpp b/apps/hybrid_render_app/main.cpp index f974a9b50fad2d6d3bf73b34f163d7933539e928..eec3c693714702815d27a5f51fd2420ce6490af4 100644 --- a/apps/hybrid_render_app/main.cpp +++ b/apps/hybrid_render_app/main.cpp @@ -1,7 +1,7 @@ #include <fstream> -#include "projects/deep_blending/renderer/DeepBlendingView.hpp" +#include "projects/inside_out_deep_blending/renderer/DeepBlendingView.hpp" #include "projects/color_harmonize/renderer/HybridView.hpp" #include "projects/color_harmonize/renderer/PerViewMeshDebugView.hpp" #include <core/graphics/Window.hpp> @@ -133,7 +133,7 @@ int main(int ac, char** av) { SIBR_LOG << "[HybridApp] : Creating Deep Blending Scene" << std::endl; dbScene.reset(new DeepBlendingScene(scene, window, dbArgs)); - compareView.reset(new DeepBlendingView(dbScene, "", sceneResWidth, sceneResHeight)); + compareView.reset(new DeepBlendingView(dbScene, dbArgs, sceneResWidth, sceneResHeight)); compareView->active(false); } @@ -300,7 +300,7 @@ int main(int ac, char** av) { //dbArgs.show_patches = true; //dbArgs.use_deep_blending = false; //dbScene.reset(new DeepBlendingScene(scene, window, dbArgs)); - //compareView.reset(new DeepBlendingView(dbScene, "", sceneResWidth, sceneResHeight)); + //compareView.reset(new DeepBlendingView(dbScene, dbArgs, sceneResWidth, sceneResHeight)); //SIBR_LOG << "output_ibrn" << std::endl; //for (int i = 0; i < cameras.size(); ++i) { // compareView->onRenderIBR(*outFrame, cameras[i]); @@ -317,7 +317,7 @@ int main(int ac, char** av) { //dbArgs.show_patches = true; //dbArgs.use_deep_blending = true; //dbScene.reset(new DeepBlendingScene(scene, window, dbArgs)); - //compareView.reset(new DeepBlendingView(dbScene, "", sceneResWidth, sceneResHeight)); + //compareView.reset(new DeepBlendingView(dbScene, dbArgs, sceneResWidth, sceneResHeight)); //SIBR_LOG << "output_deepblending" << std::endl; //for (int i = 0; i < cameras.size(); ++i) { // compareView->onRenderIBR(*outFrame, cameras[i]); diff --git a/preprocess/CMakeLists.txt b/preprocess/CMakeLists.txt index 06b5137e624ff73a3dd5e126c93c5a0d07cf1f3f..6e3114a81e18624637771e7d13ebe50e3ab21a42 100644 --- a/preprocess/CMakeLists.txt +++ b/preprocess/CMakeLists.txt @@ -1,8 +1,6 @@ project(SIBR_color_harmonize_preprocess) -configure_file (${CMAKE_CURRENT_SOURCE_DIR}/settings.ini.in ${CMAKE_CURRENT_SOURCE_DIR}/settings.ini) - add_subdirectory(base_harmonize) add_subdirectory(color_harmonize) add_subdirectory(hybridToSIBR) diff --git a/preprocess/base_harmonize/CMakeLists.txt b/preprocess/base_harmonize/CMakeLists.txt index 6d103d8389245166cb6f7faab5b8d3e335fcbe99..ed1634102c6c0a072e4e46e810a343c730886ec3 100644 --- a/preprocess/base_harmonize/CMakeLists.txt +++ b/preprocess/base_harmonize/CMakeLists.txt @@ -44,13 +44,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/preprocess/color_harmonize/CMakeLists.txt b/preprocess/color_harmonize/CMakeLists.txt index 0e320ad68d39dc3c1758dbe368a129e4257104c3..a1e6e5b59e466be5be3b1a0bc49dcb17a9e678e5 100644 --- a/preprocess/color_harmonize/CMakeLists.txt +++ b/preprocess/color_harmonize/CMakeLists.txt @@ -45,13 +45,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/preprocess/depthmapmesher/CMakeLists.txt b/preprocess/depthmapmesher/CMakeLists.txt index 88ee0baf6fa616fa37b6c8f3cb8ef64df1cba3ba..5a8618c5ff631a33fd071964e4171f2dd10905e3 100644 --- a/preprocess/depthmapmesher/CMakeLists.txt +++ b/preprocess/depthmapmesher/CMakeLists.txt @@ -29,13 +29,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/preprocess/ibr_db_preprocess.py b/preprocess/ibr_db_preprocess.py index 352c37156abb291a8717661b288f42745e3579b8..605b716e4d42c28d269f5393c4bd2d776907d4c3 100644 --- a/preprocess/ibr_db_preprocess.py +++ b/preprocess/ibr_db_preprocess.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- # -------------------------------------------- """ @package deep_blending_preprocess This script creates Deep Blending data from a COLMAP dataset which can be fed to a Deep Blending application @@ -15,6 +17,8 @@ import subprocess import shutil import os import re +from utils.commands import getProcess +from utils.paths import getBinariesPath from os import walk @@ -59,56 +63,7 @@ def get_image_size(fname): else: return return width, height - -#=============================================================================== -# SYSTEM SETTINGS -#=============================================================================== -# INSTRUCTIONS: -# 1) call 'settings = load_settings("<your_filename>")' -# 2) then get value with 'get_settings(settings, "<your-key>")' whenever -# you want. - -import sys, getopt - -def _load_settings_keyvalue(line): - """Return a list with 2 elements: a key and a value. - Return an empty list if this line doesn't contain such pair. - """ - out = [] - if len(line) < 5: - return out - endbracket = line.find("]:") - if line[0] == '[' and endbracket > 0: - out.append(line[1:endbracket]) - out.append(line[endbracket+len("]:"):].strip()) - return out - -def load_settings(filename): - """Return a dictionary of key/value settings for the given file. - - File Format: - [your-key]: your-value - # a commented line - """ - settings_dict = {} - f = open(settings_filename, 'r') - for line in f: - pair = _load_settings_keyvalue(line[:-1]) - if len(pair) == 2: # else, it is either a comment or an error - settings_dict[pair[0]] = pair[1] - return settings_dict - -def get_settings(settings_dict, key): - """Return the value stored in 'filename'using the given 'key'. - Additionally, it automatically prints an error message. - """ - if key in settings_dict: - return settings_dict[key] - print("ERROR: Attempting to load an unknown settings key ('" + key + "')") - sys.exit(-1) - return "" - - + def checkOutput( output, force_continue ): if( output != 0): if( not force_continue ): @@ -121,16 +76,13 @@ def checkOutput( output, force_continue ): #=============================================================================== -settings_filename = "settings.ini" -settings = load_settings(settings_filename) - #-------------------------------------------- # 0. Paths, commands and options def main(argv): opts, args = getopt.getopt(argv, "hi:rd:w:g:b", ["idir=", "bin="]) executables_suffix = "" - executables_folder = "" + executables_folder = getBinariesPath() path_data = "" m_width = 0 grid_size = 32 @@ -155,50 +107,39 @@ def main(argv): create_bounds = True print(["Create bounds from cameras: ", create_bounds]) elif opt in ('-bin', '--bin'): - executables_folder = arg + executables_folder = os.path.abspath(arg) return (path_data, executables_suffix, executables_folder, m_width, grid_size, create_bounds) # m_width = 0 grid_size = 32 # create_bounds = False -path_data, executables_suffix, executables_folder, m_width, grid_size, create_bounds = main(sys.argv[1:]) +path_data, executables_suffix, executables_folder, m_width, grid_size, create_bounds = main(sys.argv[1:]) if(path_data == ""): - path_data = get_settings(settings, "path_data") - -if(executables_folder == ""): - executables_folder = get_settings(settings, "path_install") + path_data = os.path.abspath(os.path.join(os.path.dirname(__file__), "../datasets")) path_data = os.path.abspath(path_data + "/") + "/" -executables_folder = os.path.abspath(executables_folder + "/") + "/" print(['Raw_data folder: ', path_data]) print(['Executables folder: ', executables_folder]) - -path_install = get_settings(settings, "path_install") -if(executables_folder != "" ): - path_install = executables_folder -print( " path to executables : " , path_install) - - force_continue = False -recon_cmd = path_install + "sibr_recon_cmd" + executables_suffix + ".exe" -depthmap_mesher = path_install + "sibr_depthmap_mesher" + executables_suffix + ".exe" +recon_cmd = getProcess("recon_cmd" + executables_suffix, executables_folder) +depthmap_mesher = getProcess("sibr_depthmapmesher" + executables_suffix, executables_folder) #-------------------------------------------- # 1. Run recon_cmd to output an NVM scene representation print(recon_cmd) if int(m_width) > 0: - print([recon_cmd, path_data, "nvm_out", "max_width=", m_width, path_install]) - program_exit = subprocess.call([recon_cmd, path_data, "nvm_out", "max_width="+m_width, "grid_size="+str(grid_size)], cwd=path_install) + print([recon_cmd, path_data, "nvm_out", "max_width=", m_width, executables_folder]) + program_exit = subprocess.call([recon_cmd, path_data, "nvm_out", "max_width="+m_width, "grid_size="+str(grid_size)], cwd=executables_folder) else: - print([recon_cmd, path_data, "nvm_out", path_install]) - program_exit = subprocess.call([recon_cmd, path_data, "nvm_out", "grid_size="+str(grid_size)], cwd=path_install) + print([recon_cmd, path_data, "nvm_out", executables_folder]) + program_exit = subprocess.call([recon_cmd, path_data, "nvm_out", "grid_size="+str(grid_size)], cwd=executables_folder) print("Recon cmd exited with ", program_exit) sys.stdout.flush() @@ -210,8 +151,8 @@ if( not checkOutput(program_exit, force_continue) ): print(depthmap_mesher) -print([depthmap_mesher, "--path", path_data, path_install]) -program_exit = subprocess.call([depthmap_mesher, "--path", path_data], cwd=path_install) +print([depthmap_mesher, "--path", path_data, executables_folder]) +program_exit = subprocess.call([depthmap_mesher, "--path", path_data], cwd=executables_folder) print("Depthmapmesher exited with ", program_exit) sys.stdout.flush() @@ -223,17 +164,17 @@ if( not checkOutput(program_exit, force_continue) ): print(recon_cmd) if int(m_width) > 0: - print([recon_cmd, path_data, "cloud_out", "max_width=", m_width, path_install]) + print([recon_cmd, path_data, "cloud_out", "max_width=", m_width, executables_folder]) if(create_bounds): - program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "max_width="+m_width, "grid_size="+str(grid_size), "grid_bounds_from_cameras"], cwd=path_install) + program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "max_width="+m_width, "grid_size="+str(grid_size), "grid_bounds_from_cameras"], cwd=executables_folder) else: - program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "max_width="+m_width, "grid_size="+str(grid_size)], cwd=path_install) + program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "max_width="+m_width, "grid_size="+str(grid_size)], cwd=executables_folder) else: - print([recon_cmd, path_data, "cloud_out", path_install]) + print([recon_cmd, path_data, "cloud_out", executables_folder]) if(create_bounds): - program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "grid_size="+str(grid_size), "grid_bounds_from_cameras"], cwd=path_install) + program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "grid_size="+str(grid_size), "grid_bounds_from_cameras"], cwd=executables_folder) else: - program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "grid_size="+str(grid_size)], cwd=path_install) + program_exit = subprocess.call([recon_cmd, path_data, "cloud_out", "grid_size="+str(grid_size)], cwd=executables_folder) print("Recon cmd exited with ", program_exit) sys.stdout.flush() diff --git a/preprocess/patchCloud_generator/CMakeLists.txt b/preprocess/patchCloud_generator/CMakeLists.txt index 0749a664672310a7ad9c0e4bf55285e0aafc72ec..99f027f839156460d57d5148a0cb13a837239edb 100644 --- a/preprocess/patchCloud_generator/CMakeLists.txt +++ b/preprocess/patchCloud_generator/CMakeLists.txt @@ -45,13 +45,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/preprocess/photoshop_harmonize/CMakeLists.txt b/preprocess/photoshop_harmonize/CMakeLists.txt index 15b32a9e102061172e12802c8dd38b26dd5dbbe9..d1abc7486816d79f6e000c23aefa2c45a7a76343 100644 --- a/preprocess/photoshop_harmonize/CMakeLists.txt +++ b/preprocess/photoshop_harmonize/CMakeLists.txt @@ -30,14 +30,11 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/preprocess/pvmesh_refinement/CMakeLists.txt b/preprocess/pvmesh_refinement/CMakeLists.txt index 63d56f2c4c6d39117b6817d500bc3ab4fdebe071..1796cf3df83a1601c7bf434ba79e23130bbfc316 100644 --- a/preprocess/pvmesh_refinement/CMakeLists.txt +++ b/preprocess/pvmesh_refinement/CMakeLists.txt @@ -45,13 +45,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/preprocess/recon_cmd/CMakeLists.txt b/preprocess/recon_cmd/CMakeLists.txt index 64e8092c1fc5024ff7821d712fecfc0976b5eea6..d9cc1070ccf5a3b6947f08934e2b1222c2e3a3c7 100644 --- a/preprocess/recon_cmd/CMakeLists.txt +++ b/preprocess/recon_cmd/CMakeLists.txt @@ -47,13 +47,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_msr" ) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - #RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/preprocess/settings.ini.in b/preprocess/settings.ini.in deleted file mode 100644 index fe835389e66e5f6aa5887ece664cbf9d175d4813..0000000000000000000000000000000000000000 --- a/preprocess/settings.ini.in +++ /dev/null @@ -1,2 +0,0 @@ -[path_install]: ${CMAKE_INSTALL_PREFIX}/bin/ -[path_data]: ${CMAKE_INSTALL_PREFIX}/bin/datasets/rc_data/ diff --git a/renderer/BilateralFilterRenderer.cpp b/renderer/BilateralFilterRenderer.cpp index 039e57eff5f63c14ebc5e1c15e13ecd4e8e5e32b..90ec9b8018497cc3978632d9ae775ddc2b8b0650 100644 --- a/renderer/BilateralFilterRenderer.cpp +++ b/renderer/BilateralFilterRenderer.cpp @@ -122,7 +122,7 @@ void BilateralFilterRenderer::prepareLookupTable(const std::string & path) { void BilateralFilterRenderer::loadShaders() { // When reloading, relying on another renderer to copy all the shaders from src to bin. - const std::string shaderDstPath = sibr::getBinDirectory() + "/shaders_rsc/"; + const std::string shaderDstPath = sibr::getShadersDirectory("color_harmonize") + "/"; _prepass.init("Bilateral prepass", sibr::loadFile(shaderDstPath + "hybrid_composite.vert"), diff --git a/renderer/CMakeLists.txt b/renderer/CMakeLists.txt index 79d7cdae5141ba1ef9c393d3dab45b474f1bea05..7513023bd9ad76a3c6349e3c6f1b4ec714186fb0 100644 --- a/renderer/CMakeLists.txt +++ b/renderer/CMakeLists.txt @@ -1,4 +1,7 @@ -project(sibr_color_harmonize) +set(SIBR_PROJECT "color_harmonize") +project(sibr_${SIBR_PROJECT}) + +include(../../inside_out_deep_blending/renderer/cmake/dependencies.cmake) file(GLOB SOURCES "*.cpp" "*.h" "*.hpp") source_group("Source Files" FILES ${SOURCES}) @@ -12,7 +15,10 @@ file(GLOB SOURCES "*.cpp" "*.h" "*.hpp" "shaders/*.frag" "shaders/*.vert" "shade ## Specify target rules add_library(${PROJECT_NAME} SHARED ${SOURCES}) -include_directories(${Boost_INCLUDE_DIRS} .) +include_directories( + ${Boost_INCLUDE_DIRS} + ${MixKitNext_INCLUDE_DIRS} + .) target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${ASSIMP_LIBRARIES} @@ -30,7 +36,7 @@ sibr_scene sibr_renderer sibr_ulr sibr_fribr_framework -sibr_deep_blending +sibr_inside_out_deep_blending ) #define postfix for various debug/release @@ -42,25 +48,17 @@ set_target_properties(${PROJECT_NAME} PROPERTIES add_definitions( -DSIBR_EXP_COLORHARMONIZE_EXPORTS -DBOOST_ALL_DYN_LINK -DINRIA_WIN) -set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "__projects__/__color_harmonize__/__renderer__") - - +set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "__projects__/__${SIBR_PROJECT}__/__renderer__") -set(RESOURCES ${SHADERS}) -set_target_properties(${PROJECT_NAME} PROPERTIES RESOURCE "${RESOURCES}") #set(DOXY_DOC_ULR_IMG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/doc" CACHE INTERNAL "") ## globale variable used in doxyfile.in) -## Hight level macro to install in an homogen way all our ibr targets +## High level macro to install in an homogen way all our ibr targets include(install_runtime) ibr_install_target(${PROJECT_NAME} INSTALL_PDB ## mean install also MSVC IDE *.pdb file (DEST according to target type) - RSC_FILE_ADD "${PROJECT_NAME}_rsc" - #DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + SHADERS ${SHADERS} + RSC_FOLDER ${SIBR_PROJECT} + #STANDALONE ${INSTALL_STANDALONE} ## mean call install_runtime with bundle dependencies resolution COMPONENT ${PROJECT_NAME}_install ## will create custom target to install only this project ) -set_target_properties(${PROJECT_NAME}_install PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) - -add_custom_target(${PROJECT_NAME}_CopyShaders ALL COMMAND python ${CMAKE_SOURCE_DIR}/cmake/CopyShaders.py "${CMAKE_CURRENT_SOURCE_DIR}/shaders/*" "${CMAKE_INSTALL_PREFIX}/bin/shaders_rsc" VERBATIM) -add_dependencies( ${PROJECT_NAME} ${PROJECT_NAME}_CopyShaders ) -set_target_properties(${PROJECT_NAME}_CopyShaders PROPERTIES FOLDER ${SIBR_INSTALL_FOLDER}) diff --git a/renderer/HybridRenderer.cpp b/renderer/HybridRenderer.cpp index 40d35be3d811cf2a9e4fc1a78a1725f88134fe05..cdc3252f71f77c04d2f11dc357e47797eb4a0f90 100644 --- a/renderer/HybridRenderer.cpp +++ b/renderer/HybridRenderer.cpp @@ -88,8 +88,8 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s CHECK_GL_ERROR; _ulrShader.init("ULRV3", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/" + vShader + ".vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/ulr_v3_fast.frag", defines)); + sibr::loadFile(sibr::getShadersDirectory("") + "/" + vShader + ".vert"), + sibr::loadFile(sibr::getShadersDirectory("ulr") + "/ulr_v3_fast.frag", defines)); _camsCount.init(_ulrShader, "camsCount"); _nCamPos[1].init(_ulrShader, "ncam_pos"); @@ -101,8 +101,8 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s CHECK_GL_ERROR; _depthShader.init("ULRV3Depth", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/global_intersect.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/global_intersect.frag", defines)); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/global_intersect.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/global_intersect.frag", defines)); // Setup uniforms. //_nCamProj[0].init(_depthShader, "proj"); @@ -112,8 +112,8 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s CHECK_GL_ERROR; _computeMaskShader.init("CompositeMask", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/" + vShader + ".vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/composite_mask.frag", defines)); + sibr::loadFile(sibr::getShadersDirectory("") + "/" + vShader + ".vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/composite_mask.frag", defines)); _threshold.init(_computeMaskShader, "threshold_photo"); @@ -122,8 +122,8 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s CHECK_GL_ERROR; _hybridCompShader.init("HybridComposite", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/" + vShader + ".vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/" + fShader + ".frag", defines)); + sibr::loadFile(sibr::getShadersDirectory("") + "/" + vShader + ".vert"), + sibr::loadFile(sibr::getShadersDirectory("") + "/" + fShader + ".frag", defines)); _toggleMask.init(_hybridCompShader, "toggleMask"); _renderMode.init(_hybridCompShader, "renderMode"); @@ -131,19 +131,19 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s CHECK_GL_ERROR; _textureShader.init("Texture", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/texture.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/texture.frag")); + sibr::loadFile(sibr::getShadersDirectory("core") + "/texture.vert"), + sibr::loadFile(sibr::getShadersDirectory("core") + "/texture.frag")); // Create Difference shaders. _differenceShader.init("Difference", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/difference.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/difference.frag")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/difference.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/difference.frag")); CHECK_GL_ERROR; // Create Slice Difference shaders. _sliceDiffShader.init("SliceDifference", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/sliceDiff.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/sliceDiff.frag")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/sliceDiff.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/sliceDiff.frag")); _sliceView.init(_sliceDiffShader, "mode"); CHECK_GL_ERROR; @@ -153,15 +153,15 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s definesGrid.emplace_back("GRID_SIZE_Y", _grid.size().y()); definesGrid.emplace_back("GRID_SIZE_Z", _grid.size().z()); _clearBinShader.init("ClearBins", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/gpu_grid_clear.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/gpu_grid_clear.frag", definesGrid)); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/gpu_grid_clear.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/gpu_grid_clear.frag", definesGrid)); // Setup Uniforms _resolution.init(_clearBinShader, "resolution"); // Create Depth Bin shader _depthBinShader.init("DepthBins", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/voxel_fetch.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/voxel_fetch.frag", definesGrid)); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/voxel_fetch.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/voxel_fetch.frag", definesGrid)); _nCamPos[2].init(_depthBinShader, "ncam_pos"); _nCamProj[1].init(_depthBinShader, "proj"); @@ -173,17 +173,17 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s // Create patch depth shader _patchDepthShader.init("PatchDepth", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/patch_intersect.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/patch_intersect.frag")); - //sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/patch_intersect.geom")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/patch_intersect.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/patch_intersect.frag"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/patch_intersect.geom")); _nWorldToCam[1].init(_patchDepthShader, "world_to_camera"); _nCam2Clip[1].init(_patchDepthShader, "camera_to_clip"); // Create consensus filtering shader _consensusFilterShader.init("ConsensusFilter", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/"+ vShader + ".vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/consensus_filter.frag")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/"+ vShader + ".vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/consensus_filter.frag")); _nWorldToCam[4].init(_consensusFilterShader, "world_to_camera"); _nCam2Clip[4].init(_consensusFilterShader, "camera_to_clip"); _displayLayer.init(_consensusFilterShader, "selected_layer"); @@ -191,8 +191,8 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s // Create peeling and blend shaders _peelingShader.init("PeelingBlendShader", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/peeling.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/peeling.frag", defines)); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/peeling.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/peeling.frag", defines)); // Setup Uniforms _ibrSigma.init(_peelingShader, "sigma"); @@ -209,27 +209,27 @@ void sibr::HybridRenderer::setupShaders(const std::string& fShader, const std::s // Create average and dump shader _averageShader.init("AverageShader", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/average.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/average.frag")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/average.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/average.frag")); _dumpShader.init("DumpShader", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/dump.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/dump.frag")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/dump.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/dump.frag")); _displayLayer1.init(_dumpShader, "selected_layer"); // Create guided filter shader _guidedFilter.init("GuidedGilter", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/hybrid_composite.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/guided_filter.frag")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/hybrid_composite.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/guided_filter.frag")); _filterThreshold.init(_guidedFilter, "threshold"); _kernelSize.init(_guidedFilter, "kernelSize"); _variableSigma.init(_guidedFilter, "variableSigma"); _pvMeshShader.init("PerViewMesh", - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/perview_mesh.vert"), - sibr::loadFile(sibr::getBinDirectory() + "/shaders_rsc/perview_mesh.frag")); + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/perview_mesh.vert"), + sibr::loadFile(sibr::getShadersDirectory("color_harmonize") + "/perview_mesh.frag")); _nCam2Clip[3].init(_pvMeshShader, "camera_to_clip"); _nWorldToCam[3].init(_pvMeshShader, "world_to_camera"); diff --git a/renderer/HybridRenderer.hpp b/renderer/HybridRenderer.hpp index f2a743727994f6c37d1628a54646f775533710a4..4c04444fd2d30415aee75928b21b5d44bf2fad95 100644 --- a/renderer/HybridRenderer.hpp +++ b/renderer/HybridRenderer.hpp @@ -52,9 +52,9 @@ namespace sibr { * \param facecull Should the mesh be renderer with backface culling. */ HybridRenderer(const std::vector<sibr::InputCamera::Ptr>& cameras, - const uint w, const uint h, - const std::string& fShader = "hybrid_composite", - const std::string& vShader = "hybrid_composite", + const uint w, const uint h, + const std::string & fShader = "color_harmonize/hybrid_composite", + const std::string & vShader = "color_harmonize/hybrid_composite", const bool facecull = true ); @@ -71,8 +71,8 @@ namespace sibr { const std::vector<PatchCloud::Component::Ptr>& components, const sibr::VoxelGridFRIBR& grid, const sibr::VoxelGridFRIBR& fineGrid, const uint w, const uint h, - const std::string& fShader = "hybrid_composite", - const std::string& vShader = "hybrid_composite", + const std::string& fShader = "color_harmonize/hybrid_composite", + const std::string& vShader = "color_harmonize/hybrid_composite", const bool facecull = true ); @@ -83,8 +83,8 @@ namespace sibr { * \param vShader The name of the vertex shader to use. */ virtual void setupShaders( - const std::string & fShader = "hybrid_composite", - const std::string & vShader = "hybrid_composite" + const std::string & fShader = "color_harmonize/hybrid_composite", + const std::string & vShader = "color_harmonize/hybrid_composite" ); /** diff --git a/renderer/HybridView.cpp b/renderer/HybridView.cpp index d547e2623e94e4d597df27ed8afb235de47d6fa6..712206db1c418bb34ec5ee66f35f08c3b7034ed4 100644 --- a/renderer/HybridView.cpp +++ b/renderer/HybridView.cpp @@ -25,7 +25,7 @@ sibr::HybridView::HybridView(const sibr::HybridScene::Ptr & ibrScene, uint rende _coloredMeshRenderer.reset(new ColoredMeshRenderer()); _texturedRenderer.reset(new TexturedMeshRenderer()); - _ulrRenderer.reset(new ULRV3Renderer(_hybridScene->cameras()->inputCameras(), w, h, "ulr_v3_fast")); + _ulrRenderer.reset(new ULRV3Renderer(_hybridScene->cameras()->inputCameras(), w, h, "ulr/ulr_v3_fast")); _poissonRenderer.reset(new PoissonRenderer(w, h)); _poissonRenderer->enableFix() = true; @@ -166,7 +166,7 @@ void sibr::HybridView::onUpdate(Input & input) if (input.key().isReleased(Key::F8)) { const std::string shaderSrcPath = "../../src/projects/color_harmonize/renderer/shaders/"; - const std::string shaderDstPath = sibr::getBinDirectory() + "/shaders_rsc/"; + const std::string shaderDstPath = sibr::getShadersDirectory("color_harmonize") + "/"; const auto files = sibr::listFiles(shaderSrcPath, false, false, { "vert", "frag", "geom" }); for (const auto& file : files) { sibr::copyFile(shaderSrcPath + file, shaderDstPath + file, true); @@ -465,10 +465,10 @@ void sibr::HybridView::setMode(const WeightsMode mode) { _weightsMode = mode; if (_weightsMode == VARIANCE_BASED_W) { - _ulrRenderer->setupShaders("ulr_v3_alt"); + _ulrRenderer->setupShaders("ulr/ulr_v3_alt"); } else if (_weightsMode == ULR_FAST) { - _ulrRenderer->setupShaders("ulr_v3_fast"); + _ulrRenderer->setupShaders("ulr/ulr_v3_fast"); } else { _ulrRenderer->setupShaders(); diff --git a/renderer/PerViewMeshDebugView.cpp b/renderer/PerViewMeshDebugView.cpp index d09011e64e2b4c0fb5cf7c2b32f31b75806561a6..8398b5c0b894758a5d10a8ec4d983d23b892f6ba 100644 --- a/renderer/PerViewMeshDebugView.cpp +++ b/renderer/PerViewMeshDebugView.cpp @@ -87,7 +87,7 @@ void sibr::PerViewMeshDebugView::onUpdate(Input& input) if (input.key().isReleased(Key::F8)) { const std::string shaderSrcPath = "../../src/projects/color_harmonize/renderer/shaders/"; - const std::string shaderDstPath = sibr::getBinDirectory() + "/shaders_rsc/"; + const std::string shaderDstPath = sibr::getShadersDirectory("color_harmonize") + "/"; const auto files = sibr::listFiles(shaderSrcPath, false, false, { "vert", "frag", "geom" }); for (const auto& file : files) { sibr::copyFile(shaderSrcPath + file, shaderDstPath + file, true); diff --git a/renderer/patch_cloud.cpp b/renderer/patch_cloud.cpp index 69f7fa5747e57988d54ef903b742ae78f14899ba..9bfbd4e828e4da6c59c56b160cc8bf00753afccd 100644 --- a/renderer/patch_cloud.cpp +++ b/renderer/patch_cloud.cpp @@ -7,15 +7,15 @@ #include "projects/fribr_framework/renderer/tools/sized_priority_queue.h" #include "projects/fribr_framework/renderer/tools/profiling.h" #include "projects/fribr_framework/renderer/tools/geometry_tools.h" -#include "projects/deep_blending/renderer/simple_ransac.h" +#include "projects/inside_out_deep_blending/renderer/simple_ransac.h" #pragma GCC diagnostic push #pragma GCC diagnostic warning "-fpermissive" -#include <projects/deep_blending/renderer/MixKit/stdmix.h> -#include "projects/deep_blending/renderer/MixKit/MxStdModel.h" -#include "projects/deep_blending/renderer/MixKit/MxQSlim.h" +#include <MixKit/stdmix.h> +#include "MixKit/MxStdModel.h" +#include "MixKit/MxQSlim.h" #pragma GCC diagnostic pop diff --git a/renderer/voxel_grid.cpp b/renderer/voxel_grid.cpp index ee2986a1608055d99a2316b6df6f7399e7fff86a..5b960bc3441eb0287bf776b4973edca3668d64a9 100644 --- a/renderer/voxel_grid.cpp +++ b/renderer/voxel_grid.cpp @@ -1,5 +1,5 @@ #include "voxel_grid.h" -#include "projects/deep_blending/renderer/tri_box_overlap.h" +#include "projects/inside_out_deep_blending/renderer/tri_box_overlap.h" namespace sibr {