LiuLimingCode / HFNet_SLAM

HFNet-SLAM: An accurate and real-time monocular SLAM system with deep features
79 stars 15 forks source link

Build issue #9

Closed KaareLJensen closed 9 months ago

KaareLJensen commented 10 months ago

I have been trying to build this repo and encounterd the same issue and in issue #4 . Seem to be an issue of namespacing overwrite. To others with the same problem I found the issues to be in "HFNetRTModel.cc". The namespace scope is set wrong here (don't know how this can build at all, but maybe something with compiler version). Just change the namespace scope to not include the #include and using statements. A code snippets below: Current:

#include "Extractors/HFNetRTModel.h"

namespace ORB_SLAM3
{

#ifdef USE_TENSORRT
#include <fstream>
#include <NvOnnxParser.h>
#include <cuda_runtime.h>

using namespace cv;
using namespace std;
using namespace nvinfer1;

void RTLogger::log(Severity severity, AsciiChar const* msg) noexcept

Updated and building:

#include "Extractors/HFNetRTModel.h"

#ifdef USE_TENSORRT
#include <fstream>
#include <NvOnnxParser.h>
#include <cuda_runtime.h>

using namespace cv;
using namespace std;
using namespace nvinfer1;

namespace ORB_SLAM3
{
void RTLogger::log(Severity severity, AsciiChar const* msg) noexcept
LiuLimingCode commented 9 months ago

Hello, I assume the compile problem is mainly due to the wrong opencv version. I have updated a new patch. Can you recompile everything and make sure these is -- Found OpenCV: /usr (found suitable version "4.2.0", minimum required is "4.2.0") in the compiler log

KaareLJensen commented 9 months ago

Maybe. I used OpenCV v.4.5.4. And maybe this can be solved by using the OpenCV v.4.2.0 as you write. But I still think the namespace need to be positions after the using statements. As this easy change solved my issue and worked with OpenCV v.4.5.4. Unfurtunatelly I cannot test with OpenCV v.4.2.0 now as I have moved on to other projects. Maybe I can return to this later. But hopefully this infomation will help others.

LiuLimingCode commented 9 months ago

You are right; I'll soon change this code. Thank you very much.