Skip to content

Commit

Permalink
1.address the 'SURF' problem in OpenCV3.x;2.address X11 conflicts of …
Browse files Browse the repository at this point in the history
…'Status'
  • Loading branch information
dpzou committed Apr 6, 2018
1 parent c3cce7b commit ba3ba9a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ This is a computer vision library developed for CoSLAM. Please click [here](http
#### 2. Nvidia Cg toolkit
Please click [here](https://developer.nvidia.com/cg-toolkit-download) to download the nvidia Cg toolkit. Click the .deb file to install the package.

#### 3. GLEW
#### 3. GLEW, xmu
Can be installed from the repository of Ubuntu or Linux Mint by typing

sudo apt-get install libglew-dev
sudo apt-get install libxmu-dev

#### 4. OpenGL, GLU, and GLUT
OpenGL is supported by default after the nvidia graphics card driver being installed. To install GLU,GLUT, run
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/FindGLEW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ELSE (WIN32)
DOC "GLEW library detected!")
ENDIF (WIN32)

message(status, "libraries:" ${GLEW_LIBRARY})
#message(status, "libraries:" ${GLEW_LIBRARY})

IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
SET( GLEW_FOUND TRUE CACHE STRING "GLEW library has been detected!")
Expand Down
2 changes: 1 addition & 1 deletion src/app/SL_CoSLAM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void CoSLAM::grabReadFrame() {

pthread_t threads[SLAM_MAX_NUM];
for (int i = 1; i < numCams; i++) {
pthread_create(&threads[i], 0, _parallelReadNextFrame, (void*) i);
pthread_create(&threads[i], 0, _parallelReadNextFrame, reinterpret_cast<void*>(i));
}
slam[0].grabReadFrame();
for (int i = 1; i < numCams; i++) {
Expand Down
16 changes: 13 additions & 3 deletions src/app/SL_InitMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
#include "slam/SL_FeatureMatching.h"
#include "SL_CoSLAMBA.h"
#include "SL_GlobParam.h"

#if CV_MAJOR_VERSION <= 2
#if CV_MINOR_VERSION > 3
#include <opencv2/nonfree/features2d.hpp>
#endif
#elif(CV_MAJOR_VERSION == 3)
#include <opencv2/xfeatures2d.hpp>
#endif

//#define DEBUG_MODE
InitMap::InitMap() :
Expand All @@ -41,16 +44,23 @@ void InitMap::detectSurfFeats(int iCam) {
const ImgG* img = m_pImgGray[iCam];
KpVec& keyPts = m_cvSurfPts[iCam];
std::vector<float> desc;

cv::Mat cvImg(img->rows, img->cols, CV_8UC1, img->data);
#if CV_MAJOR_VERSION <= 2
#if CV_MINOR_VERSION > 3
cv::SurfFeatureDetector surf(400, 4, 2, false);
cv::Mat cvImg(img->rows, img->cols, CV_8UC1, img->data);
surf(cvImg, cv::Mat(), keyPts, desc);
int dimDesc = surf.descriptorSize();
#else
cv::SURF surf(400, 4, 2, false);
cv::Mat cvImg(img->rows, img->cols, CV_8UC1, img->data);
surf(cvImg, cv::Mat(), keyPts, desc);
int dimDesc = surf.descriptorSize();
#endif
#elif CV_MAJOR_VERSION == 3
using namespace cv::xfeatures2d;
cv::Ptr<SURF> surf = SURF::create(400, 4, 2, false);
surf->detectAndCompute(cvImg,cv::Mat(), keyPts, desc);
int dimDesc = surf->descriptorSize();
#endif
m_surfDesc[iCam].resize(keyPts.size(), dimDesc);

Expand Down
2 changes: 1 addition & 1 deletion src/gui/GLImagePane.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

#ifndef GLIMAGEPANE_H_
#define GLIMAGEPANE_H_
#include "app/SL_CoSLAM.h"

#include <GL/glew.h> // should be included before "wx/glcanvas.h"
#include "wx/wx.h"
#include "wx/glcanvas.h"

#include "app/SL_CoSLAM.h"
class GLImagePane: public wxGLCanvas {
wxGLContext* m_context;
unsigned char* imgData;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/GLScenePane.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#ifndef GLSCENEPANE_H_
#define GLSCENEPANE_H_
#include "app/SL_CoSLAM.h"
#include "GL/glew.h"
#include "GLTrackballPane.h"
#include "app/SL_CoSLAM.h"

using namespace std;
class GLScenePane: public GLTrackballPane {
Expand Down
2 changes: 2 additions & 0 deletions src/gui/MyApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#ifndef MYAPP_H_
#define MYAPP_H_
#undef Status
#include <opencv2/opencv.hpp>

#include "app/SL_CoSLAM.h"
#include "app/SL_GlobParam.h"
Expand Down

0 comments on commit ba3ba9a

Please sign in to comment.