Skip to content

Commit

Permalink
Working on compatibility Windows - Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
MarianoJT88 committed Jan 16, 2015
1 parent 6b61fc5 commit 738ce8d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 24 deletions.
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(CUDA_NVCC_FLAGS "-arch=sm_20")

#Build scene flow CUDA lib
CUDA_ADD_LIBRARY(pdflow_cudalib pdflow_cudalib.h pdflow_cudalib.cu)
#message( ${CUDA_LIBRARIES} )


SET(DEFAULT_BUILD_EVALUATOR ON)
SET(BUILD_EVALUATOR ${DEFAULT_BUILD_EVALUATOR} CACHE BOOL "Build the scene flow evaluator for a RGB-D frame pair that uses OpenCV")
Expand All @@ -32,17 +32,22 @@ IF (BUILD_EVALUATOR)
ENDIF (BUILD_EVALUATOR)

SET(DEFAULT_BUILD_RT_VISUALIZATION ON)
SET(BUILD_RT_VISUALIZATION ${DEFAULT_BUILD_RT_VISUALIZATION} CACHE BOOL "Build the scene flow estimator with real-time visualization that uses MRPT and OpenNI2")
SET(BUILD_RT_VISUALIZATION ${DEFAULT_BUILD_RT_VISUALIZATION} CACHE BOOL "Build the scene flow estimator with real-time visualization that requires MRPT and OpenNI2")

IF (BUILD_RT_VISUALIZATION)
FIND_PACKAGE(MRPT REQUIRED base gui opengl)

INCLUDE_DIRECTORIES($ENV{OPENNI2_INCLUDE})
LINK_DIRECTORIES($ENV{OPENNI2_LIB})
SET(OpenNI_lib "/usr/lib/libOpenNI2.so")
#SET(OpenNI_lib "C:/Users/Mariano/Programas/OpenNI2_32/Lib/OpenNI2.lib")
IF (WIN32)
INCLUDE_DIRECTORIES($ENV{OPENNI2_INCLUDE})
LINK_DIRECTORIES($ENV{OPENNI2_LIB})
SET(OpenNI_lib "$ENV{OPENNI2_LIB}/OpenNI2.lib")
ENDIF (WIN32)

IF (UNIX)
SET(OpenNI_lib "/usr/lib/libOpenNI2.so")
ENDIF (UNIX)

#message( "jajaj y esto vale ${OPENNI2_INCLUDE}" )
message( "esto vale ${OpenNI_lib}" )

ADD_EXECUTABLE(Scene-Flow-Visualization
main_scene_flow_visualization.cpp
Expand Down
3 changes: 1 addition & 2 deletions main_scene_flow_impair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ int main(int num_arg, char *argv[])
else
{
if ( string(argv[1]) == "--rows")
//Windows -> rows = stof(string(argv[2]));
rows = strtof(argv[2], NULL);
rows = stoi(argv[2], NULL);
}

//==============================================================================
Expand Down
7 changes: 4 additions & 3 deletions main_scene_flow_visualization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ int main(int num_arg, char *argv[])
for (int i=1; i<num_arg; i++)
{
if ( string(argv[i]) == "--cam_mode")
cam_mode = strtof(argv[i+1], NULL);
cam_mode = stoi(argv[i+1], NULL);

if ( string(argv[i]) == "--fps")
fps = strtof(argv[i+1], NULL);
fps = stoi(argv[i+1], NULL);
//fps = strtof(argv[i+1], NULL);

if ( string(argv[i]) == "--rows")
rows = strtof(argv[i+1], NULL);
rows = stoi(argv[i+1], NULL);
}
}

Expand Down
21 changes: 13 additions & 8 deletions scene_flow_impair.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,26 @@
** **
*****************************************************************************/

//Windows -> #include <opencv2/core.hpp>
#if BUILD_PLATFORM == WINDOWS_BUILD
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#elif BUILD_PLATFORM == LINUX_BUILD
#include <opencv2/core/core.hpp>
//Windows -> #include <opencv2/highgui.hpp>
#include <opencv2/highgui/highgui.hpp>
#endif

#include "pdflow_cudalib.h"
#include "legend_pdflow.xpm"
#include <ostream>

//Windows -> #define M_PI 3.14159265f
//Windows -> #define M_LOG2E 1.44269504088896340736f //log2(e)

//Windows
//inline float log2(const float x){
// return log(x) * M_LOG2E;
//}
#if BUILD_PLATFORM == WINDOWS_BUILD

#define M_PI 3.14159265f
#define M_LOG2E 1.44269504088896340736f //log2(e)
inline float log2(const float x){ return log(x) * M_LOG2E; }

#endif


class PD_flow_opencv {
Expand Down
12 changes: 8 additions & 4 deletions scene_flow_visualization.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@
#include <mrpt/system.h>
#include <mrpt/gui/CDisplayWindow3D.h>
#include <mrpt/opengl.h>
//Windows #include <OpenNI.h>
#if BUILD_PLATFORM == WINDOWS_BUILD
#include <OpenNI.h>
#elif BUILD_PLATFORM == LINUX_BUILD
#include <openni2/OpenNI.h>
#endif
#include <Eigen/src/Core/Matrix.h>
#include "pdflow_cudalib.h"
#include "legend_pdflow.xpm"

#if BUILD_PLATFORM == WINDOWS_BUILD

//#define M_LOG2E 1.44269504088896340736f //log2(e)
inline float log2(const float x){ return log(x) * M_LOG2E; }

//inline float log2(const float x){
// return log(x) * M_LOG2E;
//}
#endif


using namespace mrpt;
Expand Down

0 comments on commit 738ce8d

Please sign in to comment.