Skip to content

Commit

Permalink
[Fixed] fixed crash
Browse files Browse the repository at this point in the history
added compile option native , ![ref](borglab/gtsam#75)
  • Loading branch information
lacie-life committed Mar 5, 2022
1 parent f57fe44 commit a51113f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ 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)

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"
Expand Down
2 changes: 1 addition & 1 deletion include/View/Screen_Def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/AppEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void AppEngine::slotReceiveEvent(int event)
break;
case static_cast<int>(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;
Expand Down
23 changes: 14 additions & 9 deletions src/Plugin/SfM/QSfM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#include <QVector>

#include <gtsam/geometry/Point2.h>
#include <gtsam/geometry/Pose3.h>
#include <gtsam/geometry/Point3.h>
#include <gtsam/geometry/PinholeCamera.h>
#include <gtsam/geometry/Cal3_S2.h>

#include <gtsam/inference/Symbol.h>
#include <gtsam/slam/PriorFactor.h>
#include <gtsam/slam/ProjectionFactor.h>
Expand Down Expand Up @@ -471,20 +476,20 @@ void QSfM::bundleAdjustment()

initial.insert<gtsam::Point3>(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::PriorFactor<gtsam::Point3>>(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::PriorFactor<gtsam::Point3>>(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;
}
}

Expand Down

0 comments on commit a51113f

Please sign in to comment.