From a51113f04ffa0755faaa36aaac38f4d0568ef8da Mon Sep 17 00:00:00 2001 From: lacie-life <00sao00ios00@gmail.com> Date: Sat, 5 Mar 2022 15:25:55 +0700 Subject: [PATCH] [Fixed] fixed crash added compile option native , ![ref](https://github.com/borglab/gtsam/issues/75) --- CMakeLists.txt | 6 ++++-- include/View/Screen_Def.h | 2 +- src/AppEngine.cpp | 2 +- src/Plugin/SfM/QSfM.cpp | 23 ++++++++++++++--------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e116a04..b9fbfd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ set(CMAKE_CXX_STANDARD 11) SET(COMPILE_FLAGS "-m64 -std=c++11 -Wall -Wextra -pedantic") SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}" ) +add_compile_options("-march=native") + set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -12,8 +14,8 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) -list(APPEND QML_IMPORT_PATH "/home/lacie/Qt/5.15.2/gcc_64/qml") -set(CMAKE_PREFIX_PATH "/home/lacie/Qt/5.15.2/gcc_64") +list(APPEND QML_IMPORT_PATH "/home/jun/Qt/5.15.2/gcc_64/qml") +set(CMAKE_PREFIX_PATH "/home/jun/Qt/5.15.2/gcc_64") set(QML_IMPORT_PATH ${QML_IMPORT_PATH} CACHE STRING "Qt Creator 4.1 extra qml import paths" diff --git a/include/View/Screen_Def.h b/include/View/Screen_Def.h index 28f11f2..54d06d5 100644 --- a/include/View/Screen_Def.h +++ b/include/View/Screen_Def.h @@ -55,7 +55,7 @@ class ScreenDef : public QObject ScreenDef(const ScreenDef&) = delete; void operator =(const ScreenDef&) = delete; - DEF_SCREEN(QML_FOLDER , "file:/home/lacie/Github/GreenHouseAR/assest/qml/") + DEF_SCREEN(QML_FOLDER , "file:/home/jun/Github/GreenHouseAR/assest/qml/") DEF_SCREEN(QML_APP , QML_FOLDER() + "main.qml") signals: diff --git a/src/AppEngine.cpp b/src/AppEngine.cpp index d65df70..c07b550 100644 --- a/src/AppEngine.cpp +++ b/src/AppEngine.cpp @@ -65,7 +65,7 @@ void AppEngine::slotReceiveEvent(int event) break; case static_cast(AppEnums::EVT_CLICK_RUN_SfM): CONSOLE << "Run SfM Event"; - MODEL->runSfM("/home/lacie/Github/GreenHouseAR/assest/data/crazyhorse"); + MODEL->runSfM("/home/jun/Github/GreenHouseAR/assest/data/crazyhorse"); break; default: break; diff --git a/src/Plugin/SfM/QSfM.cpp b/src/Plugin/SfM/QSfM.cpp index 8cef047..33b0a19 100644 --- a/src/Plugin/SfM/QSfM.cpp +++ b/src/Plugin/SfM/QSfM.cpp @@ -8,6 +8,11 @@ #include #include +#include +#include +#include +#include + #include #include #include @@ -471,20 +476,20 @@ void QSfM::bundleAdjustment() initial.insert(gtsam::Symbol('l', i), gtsam_p); -// if (!init_prior) { -// init_prior = true; + if (!init_prior) { + init_prior = true; -// gtsam::noiseModel::Isotropic::shared_ptr point_noise = gtsam::noiseModel::Isotropic::Sigma(3, 0.1); -// graph.emplace_shared>(gtsam::Symbol('l', i), gtsam_p, point_noise); -// } + gtsam::noiseModel::Isotropic::shared_ptr point_noise = gtsam::noiseModel::Isotropic::Sigma(3, 0.1); + graph.emplace_shared>(gtsam::Symbol('l', i), gtsam_p, point_noise); + } } } -// result = gtsam::LevenbergMarquardtOptimizer(graph, initial).optimize(); + result = gtsam::LevenbergMarquardtOptimizer(graph, initial).optimize(); -// cout << endl; -// cout << "initial graph error = " << graph.error(initial) << endl; -// cout << "final graph error = " << graph.error(result) << endl; + cout << endl; + cout << "initial graph error = " << graph.error(initial) << endl; + cout << "final graph error = " << graph.error(result) << endl; } }