Skip to content

Commit

Permalink
Remove GUI&Qt&OpenGL Component
Browse files Browse the repository at this point in the history
  • Loading branch information
cdowen committed Jul 12, 2019
1 parent 7b0c938 commit 557f490
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 82 deletions.
30 changes: 10 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ if(CUDA_ENABLED)
find_package(CUDA ${CUDA_MIN_VERSION} QUIET)
endif()

find_package(Qt5 5.4 REQUIRED COMPONENTS Core OpenGL Widgets)
# find_package(Qt5 5.4 REQUIRED COMPONENTS Core OpenGL Widgets)

if(Qt5_FOUND)
message(STATUS "Found Qt")
Expand Down Expand Up @@ -237,16 +237,6 @@ else()
set(CGAL_ENABLED OFF)
endif()

# Qt5 was built with -reduce-relocations.
if(Qt5_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(CUDA_ENABLED AND NOT IS_MSVC)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --compiler-options -fPIC")
endif()
endif()

# Enable automatic compilation of Qt resource files.
set(CMAKE_AUTORCC ON)


################################################################################
Expand All @@ -263,9 +253,9 @@ set(COLMAP_INCLUDE_DIRS
${FREEIMAGE_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS}
${Qt5Core_INCLUDE_DIRS}
${Qt5OpenGL_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
# ${Qt5Core_INCLUDE_DIRS}
# ${Qt5OpenGL_INCLUDE_DIRS}
# ${Qt5Widgets_INCLUDE_DIRS}
)

set(COLMAP_LINK_DIRS
Expand All @@ -280,12 +270,12 @@ set(COLMAP_EXTERNAL_LIBRARIES
${Boost_SYSTEM_LIBRARY}
${GLOG_LIBRARIES}
${FREEIMAGE_LIBRARIES}
${CERES_LIBRARIES}
${CERES_LIBRARIES}`
${OPENGL_gl_LIBRARY}
${OPENGL_glu_LIBRARY}
${Qt5Core_LIBRARIES}
${Qt5OpenGL_LIBRARIES}
${Qt5Widgets_LIBRARIES}
# ${Qt5Core_LIBRARIES}
# ${Qt5OpenGL_LIBRARIES}
# ${Qt5Widgets_LIBRARIES}
)

if(CGAL_ENABLED)
Expand Down Expand Up @@ -354,7 +344,7 @@ COLMAP_ADD_SOURCE_DIR(src/optim OPTIM_SRCS *.h *.cc)
COLMAP_ADD_SOURCE_DIR(src/retrieval RETRIEVAL_SRCS *.h *.cc)
COLMAP_ADD_SOURCE_DIR(src/sfm SFM_SRCS *.h *.cc)
COLMAP_ADD_SOURCE_DIR(src/tools TOOLS_SRCS *.h *.cc)
COLMAP_ADD_SOURCE_DIR(src/ui UI_SRCS *.h *.cc)
#COLMAP_ADD_SOURCE_DIR(src/ui UI_SRCS *.h *.cc)
COLMAP_ADD_SOURCE_DIR(src/util UTIL_SRCS *.h *.cc)

# Add all of the source files to a regular library target, as using a custom
Expand All @@ -380,7 +370,7 @@ add_library(
${RETRIEVAL_SRCS}
${SFM_SRCS}
${TOOLS_SRCS}
${UI_SRCS}
# ${UI_SRCS}
${UTIL_SRCS}
)

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ add_subdirectory(optim)
add_subdirectory(retrieval)
add_subdirectory(sfm)
add_subdirectory(tools)
add_subdirectory(ui)
#add_subdirectory(ui)
add_subdirectory(util)

COLMAP_ADD_LIBRARY(colmap ${COLMAP_SOURCES})
Expand Down
100 changes: 59 additions & 41 deletions src/exe/colmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>

#include "mvs/fusion.h"
#include "base/undistortion.h"
#include "base/similarity_transform.h"
#include "controllers/automatic_reconstruction.h"
#include "controllers/bundle_adjustment.h"
Expand All @@ -47,8 +49,9 @@
#include "mvs/meshing.h"
#include "mvs/patch_match.h"
#include "retrieval/visual_index.h"
#include "ui/main_window.h"
#include "util/opengl_utils.h"
//#include "ui/main_window.h"

//#include "util/opengl_utils.h"
#include "util/version.h"

using namespace colmap;
Expand All @@ -58,7 +61,8 @@ const bool kUseOpenGL = false;
#else
const bool kUseOpenGL = true;
#endif

// No GUI!
/*
int RunGraphicalUserInterface(int argc, char** argv) {
OptionManager options;
Expand Down Expand Up @@ -89,6 +93,8 @@ int RunGraphicalUserInterface(int argc, char** argv) {
return app.exec();
}
*/

int RunAutomaticReconstructor(int argc, char** argv) {
AutomaticReconstructionController::Options reconstruction_options;
std::string data_type = "individual";
Expand Down Expand Up @@ -161,10 +167,10 @@ int RunAutomaticReconstructor(int argc, char** argv) {
ReconstructionManager reconstruction_manager;

if (reconstruction_options.use_gpu && kUseOpenGL) {
QApplication app(argc, argv);
// QApplication app(argc, argv);
AutomaticReconstructionController controller(reconstruction_options,
&reconstruction_manager);
RunThreadWithOpenGLContext(&controller);
// RunThreadWithOpenGLContext(&controller);
} else {
AutomaticReconstructionController controller(reconstruction_options,
&reconstruction_manager);
Expand Down Expand Up @@ -426,17 +432,17 @@ int RunExhaustiveMatcher(int argc, char** argv) {
options.AddExhaustiveMatchingOptions();
options.Parse(argc, argv);

std::unique_ptr<QApplication> app;
if (options.sift_matching->use_gpu && kUseOpenGL) {
app.reset(new QApplication(argc, argv));
}
//std::unique_ptr<QApplication> app;
//if (options.sift_matching->use_gpu && kUseOpenGL) {
// app.reset(new QApplication(argc, argv));
//}

ExhaustiveFeatureMatcher feature_matcher(*options.exhaustive_matching,
*options.sift_matching,
*options.database_path);

if (options.sift_matching->use_gpu && kUseOpenGL) {
RunThreadWithOpenGLContext(&feature_matcher);
// RunThreadWithOpenGLContext(&feature_matcher);
} else {
feature_matcher.Start();
feature_matcher.Wait();
Expand Down Expand Up @@ -493,16 +499,18 @@ int RunFeatureExtractor(int argc, char** argv) {
return EXIT_FAILURE;
}

std::unique_ptr<QApplication> app;
if (options.sift_extraction->use_gpu && kUseOpenGL) {
app.reset(new QApplication(argc, argv));
}
//std::unique_ptr<QApplication> app;
//if (options.sift_extraction->use_gpu && kUseOpenGL) {
// app.reset(new QApplication(argc, argv));
//}

SiftFeatureExtractor feature_extractor(reader_options,
*options.sift_extraction);

if (options.sift_extraction->use_gpu && kUseOpenGL) {
RunThreadWithOpenGLContext(&feature_extractor);
//RunThreadWithOpenGLContext(&feature_extractor);
std::cerr << "ERROR: OpenGL Disabled.";
return EXIT_FAILURE;
} else {
feature_extractor.Start();
feature_extractor.Wait();
Expand Down Expand Up @@ -985,10 +993,10 @@ int RunMatchesImporter(int argc, char** argv) {
options.AddMatchingOptions();
options.Parse(argc, argv);

std::unique_ptr<QApplication> app;
if (options.sift_matching->use_gpu && kUseOpenGL) {
app.reset(new QApplication(argc, argv));
}
//std::unique_ptr<QApplication> app;
//if (options.sift_matching->use_gpu && kUseOpenGL) {
// app.reset(new QApplication(argc, argv));
//}

std::unique_ptr<Thread> feature_matcher;
if (match_type == "pairs") {
Expand All @@ -1008,7 +1016,9 @@ int RunMatchesImporter(int argc, char** argv) {
}

if (options.sift_matching->use_gpu && kUseOpenGL) {
RunThreadWithOpenGLContext(feature_matcher.get());
// RunThreadWithOpenGLContext(feature_matcher.get());
std::cerr << "ERROR: OpenGL Disabled.";
return EXIT_FAILURE;
} else {
feature_matcher->Start();
feature_matcher->Wait();
Expand Down Expand Up @@ -1289,17 +1299,19 @@ int RunSequentialMatcher(int argc, char** argv) {
options.AddSequentialMatchingOptions();
options.Parse(argc, argv);

std::unique_ptr<QApplication> app;
if (options.sift_matching->use_gpu && kUseOpenGL) {
app.reset(new QApplication(argc, argv));
}
//std::unique_ptr<QApplication> app;
//if (options.sift_matching->use_gpu && kUseOpenGL) {
// app.reset(new QApplication(argc, argv));
//}

SequentialFeatureMatcher feature_matcher(*options.sequential_matching,
*options.sift_matching,
*options.database_path);

if (options.sift_matching->use_gpu && kUseOpenGL) {
RunThreadWithOpenGLContext(&feature_matcher);
//RunThreadWithOpenGLContext(&feature_matcher);
std::cerr << "ERROR: OpenGL Disabled.";
return EXIT_FAILURE;
} else {
feature_matcher.Start();
feature_matcher.Wait();
Expand Down Expand Up @@ -1668,17 +1680,19 @@ int RunSpatialMatcher(int argc, char** argv) {
options.AddSpatialMatchingOptions();
options.Parse(argc, argv);

std::unique_ptr<QApplication> app;
if (options.sift_matching->use_gpu && kUseOpenGL) {
app.reset(new QApplication(argc, argv));
}
//std::unique_ptr<QApplication> app;
//if (options.sift_matching->use_gpu && kUseOpenGL) {
// app.reset(new QApplication(argc, argv));
//}

SpatialFeatureMatcher feature_matcher(*options.spatial_matching,
*options.sift_matching,
*options.database_path);

if (options.sift_matching->use_gpu && kUseOpenGL) {
RunThreadWithOpenGLContext(&feature_matcher);
//RunThreadWithOpenGLContext(&feature_matcher);
std::cerr << "ERROR: OpenGL Disabled.";
return EXIT_FAILURE;
} else {
feature_matcher.Start();
feature_matcher.Wait();
Expand All @@ -1693,17 +1707,19 @@ int RunTransitiveMatcher(int argc, char** argv) {
options.AddTransitiveMatchingOptions();
options.Parse(argc, argv);

std::unique_ptr<QApplication> app;
if (options.sift_matching->use_gpu && kUseOpenGL) {
app.reset(new QApplication(argc, argv));
}
//std::unique_ptr<QApplication> app;
//if (options.sift_matching->use_gpu && kUseOpenGL) {
// app.reset(new QApplication(argc, argv));
//}

TransitiveFeatureMatcher feature_matcher(*options.transitive_matching,
*options.sift_matching,
*options.database_path);

if (options.sift_matching->use_gpu && kUseOpenGL) {
RunThreadWithOpenGLContext(&feature_matcher);
//RunThreadWithOpenGLContext(&feature_matcher);
std::cerr << "ERROR: OpenGL Disabled.";
return EXIT_FAILURE;
} else {
feature_matcher.Start();
feature_matcher.Wait();
Expand Down Expand Up @@ -1800,17 +1816,19 @@ int RunVocabTreeMatcher(int argc, char** argv) {
options.AddVocabTreeMatchingOptions();
options.Parse(argc, argv);

std::unique_ptr<QApplication> app;
if (options.sift_matching->use_gpu && kUseOpenGL) {
app.reset(new QApplication(argc, argv));
}
//std::unique_ptr<QApplication> app;
//if (options.sift_matching->use_gpu && kUseOpenGL) {
// app.reset(new QApplication(argc, argv));
//}

VocabTreeFeatureMatcher feature_matcher(*options.vocab_tree_matching,
*options.sift_matching,
*options.database_path);

if (options.sift_matching->use_gpu && kUseOpenGL) {
RunThreadWithOpenGLContext(&feature_matcher);
//RunThreadWithOpenGLContext(&feature_matcher);
std::cerr << "ERROR: OpenGL Disabled.";
return EXIT_FAILURE;
} else {
feature_matcher.Start();
feature_matcher.Wait();
Expand Down Expand Up @@ -2008,7 +2026,7 @@ int main(int argc, char** argv) {
InitializeGlog(argv);

std::vector<std::pair<std::string, command_func_t>> commands;
commands.emplace_back("gui", &RunGraphicalUserInterface);
// commands.emplace_back("gui", &RunGraphicalUserInterface);
commands.emplace_back("automatic_reconstructor", &RunAutomaticReconstructor);
commands.emplace_back("bundle_adjuster", &RunBundleAdjuster);
commands.emplace_back("color_extractor", &RunColorExtractor);
Expand Down
4 changes: 2 additions & 2 deletions src/feature/extraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "base/database.h"
#include "base/image_reader.h"
#include "feature/sift.h"
#include "util/opengl_utils.h"
//#include "util/opengl_utils.h"
#include "util/threading.h"

namespace colmap {
Expand Down Expand Up @@ -129,7 +129,7 @@ class SiftFeatureExtractorThread : public Thread {
const SiftExtractionOptions sift_options_;
std::shared_ptr<Bitmap> camera_mask_;

std::unique_ptr<OpenGLContextManager> opengl_context_;
// std::unique_ptr<OpenGLContextManager> opengl_context_;

JobQueue<ImageData>* input_queue_;
JobQueue<ImageData>* output_queue_;
Expand Down
6 changes: 3 additions & 3 deletions src/feature/matching.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "feature/sift.h"
#include "util/alignment.h"
#include "util/cache.h"
#include "util/opengl_utils.h"
//#include "util/opengl_utils.h"
#include "util/threading.h"
#include "util/timer.h"

Expand Down Expand Up @@ -259,7 +259,7 @@ class SiftGPUFeatureMatcher : public FeatureMatcherThread {
JobQueue<Input>* input_queue_;
JobQueue<Output>* output_queue_;

std::unique_ptr<OpenGLContextManager> opengl_context_;
// std::unique_ptr<OpenGLContextManager> opengl_context_;

// The previously uploaded images to the GPU.
std::array<image_t, 2> prev_uploaded_image_ids_;
Expand Down Expand Up @@ -303,7 +303,7 @@ class GuidedSiftGPUFeatureMatcher : public FeatureMatcherThread {
JobQueue<Input>* input_queue_;
JobQueue<Output>* output_queue_;

std::unique_ptr<OpenGLContextManager> opengl_context_;
// std::unique_ptr<OpenGLContextManager> opengl_context_;

// The previously uploaded images to the GPU.
std::array<image_t, 2> prev_uploaded_image_ids_;
Expand Down
5 changes: 4 additions & 1 deletion src/feature/sift.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include <array>
#include <fstream>
#include <memory>
#include <mutex>
#include <map>
#include <GL/glew.h>

#include "SiftGPU/SiftGPU.h"
#include "VLFeat/covdet.h"
Expand All @@ -43,7 +46,7 @@
#include "util/logging.h"
#include "util/math.h"
#include "util/misc.h"
#include "util/opengl_utils.h"
//#include "util/opengl_utils.h"

namespace colmap {
namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ COLMAP_ADD_SOURCES(
math.h math.cc
matrix.h
misc.h misc.cc
opengl_utils.h opengl_utils.cc
# opengl_utils.h opengl_utils.cc
option_manager.h option_manager.cc
ply.h ply.cc
random.h random.cc
Expand Down
Loading

0 comments on commit 557f490

Please sign in to comment.