Skip to content

Commit

Permalink
Merge remote-tracking branch 'opengp/master'
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	apps/htrack_atb/main.cpp
	apps/htrack_qt/main.cpp
	tracker/Sensor/Sensor_realsense.cpp
  • Loading branch information
Tu-Hoa Pham committed Jun 18, 2015
2 parents 15632bd + 790bfce commit 9126b47
Show file tree
Hide file tree
Showing 33 changed files with 188 additions and 107 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*.txt.user

*-build

#################
## openFrameworks
#################
Expand Down
2 changes: 1 addition & 1 deletion apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
project(htrack-helloworlds)

#--- Gets rid of annoying CMake 3 warnings
Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(FOLDERNAME ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${FOLDERNAME})
file(GLOB_RECURSE SOURCES "*.cpp")
Expand Down
6 changes: 4 additions & 2 deletions apps/helloworld_atb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})

Expand All @@ -11,6 +11,8 @@ include(../../cmake/ConfigureAntTweakBar.cmake)
INCLUDE_DIRECTORIES(../../)
#set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_BUILD_TYPE "Debug")
add_executable(${PROJECT} main.cpp)

list(APPEND SOURCES ../../tracker/TwSettings.cpp)
add_executable(${PROJECT} main.cpp ${SOURCES})
target_link_libraries(${PROJECT} ${LIBRARIES})
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR})
18 changes: 9 additions & 9 deletions apps/helloworld_atb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
#include <QOpenGLVertexArrayObject>

#include "../htrack_atb/AntTweakBarEventFilter.h"
#include "AntTweakBar.h"
TwBar* _bar = NULL;
#include "tracker/TwSettings.h"

float v1;
float g1_v1;
float g1_v2;

#include "AntTweakBar.h"


/// Format class to enable OpenGL4 core profile
class OpenGLFormat : public QGLFormat{
Expand All @@ -38,18 +39,17 @@ class GLWidget : public QGLWidget{
bool success = vao.create();
if(!success) exit(EXIT_FAILURE);
vao.bind();
TwInit(TW_OPENGL_CORE, NULL);
TwWindowSize(this->width(), this->height());
_bar = TwNewBar ("Settings");
TwAddVarRW(_bar, "p", TW_TYPE_FLOAT, &v1, "min=.5 max=50 step=0.4");
TwAddVarRW(_bar, "V1", TW_TYPE_FLOAT, &g1_v1, " group=g1 ");
TwAddVarRW(_bar, "V2", TW_TYPE_FLOAT, &g1_v2, " group=g1 ");
tw_settings->tw_init(this->width(), this->height());
tw_settings->tw_add(v1, "v1", "min=.5 max=50 step=0.4");
tw_settings->tw_add(g1_v1, "g1_v1", "group=g1");
tw_settings->tw_add(g1_v2, "g1_v2", "group=g1");
}

void paintGL() {
glClearColor(0,1,0,1); ///< green
glClear(GL_COLOR_BUFFER_BIT);
TwWindowSize(this->width(), this->height());
tw_settings->tw_draw();
// TwWindowSize(this->width(), this->height());
TwDraw();
}
};
Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_cublas/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})

Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_cudagl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECTNAME ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECTNAME})

Expand Down
10 changes: 5 additions & 5 deletions apps/helloworld_cudagl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// [1000x (w/ offscreen draw)] 1687.07 ms
// [1000x (w/o offscreen draw)] 1438.53 ms
// [cudaGraphicsUnregisterResource] 0.555032 ms
// Performance on GeForce GTX980 (Ubuntu):
// [cudaGraphicsGLRegisterImage]
// [1000x (w/ offscreen draw)]
// [1000x (w/o offscreen draw)]
// [cudaGraphicsUnregisterResource]
// Performance on GeForce GTX980 and i5@3Ghz (Ubuntu@MIT):
// [cudaGraphicsGLRegisterImage] 170.678 ms
// [1000x (w/ offscreen draw)] 204.626 ms
// [1000x (w/o offscreen draw)] 195.564 ms
// [cudaGraphicsUnregisterResource] 0.12116 ms
// Performance on GeForce GTX980 (Win8.1):
// [cudaGraphicsGLRegisterImage] 109.379 ms
// [1000x (w/ offscreen draw)] 182.223 ms
Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_opencv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})
# cmake_policy(SET CMP0046 OLD)
Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_openmp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if(UNIX AND NOT APPLE)
return()
endif()

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})

Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_openni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})

Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_qtopengl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})

Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_realsense/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if(NOT WIN32)
return()
endif()

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})

Expand Down
2 changes: 1 addition & 1 deletion apps/helloworld_thrust/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 2.8)
get_filename_component(PROJECT ${CMAKE_CURRENT_LIST_DIR} NAME)
project(${PROJECT})

Expand Down
1 change: 1 addition & 0 deletions apps/htrack_atb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ int main(int argc, char* argv[]){

#if defined(OPENNI)
Camera camera(QVGA, 60 /*FPS*/);
// Camera camera(QVGA, 30 /*FPS*/);
SensorOpenNI sensor(&camera);
#endif

Expand Down
3 changes: 2 additions & 1 deletion apps/htrack_qt/Main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "tracker/OpenGL/DebugRenderer/DebugRenderer.h"
#include "cudax/Timer.h"
#include "util/opencv_wrapper.h"
#include "util/mylogger.h"

#include "tracker/Worker.h"
#include "tracker/Tracker.h"
Expand Down Expand Up @@ -357,7 +358,7 @@ void Main_window::menu_initialize_offset()

void Main_window::display_frame(int frame_id){
if((frame_id<0) || !(frame_id<datastream->size())){
printf("!!!WARNING frame_id out of range: 0<=%d<%d\n",frame_id, datastream->size());
mWarning("frame_id out of range: 0<=%d<%d\n",frame_id, datastream->size());
fflush(stdout);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion apps/htrack_qt/OpenGL_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

#include "util/gl_wrapper.h"
#include <memory>
#include <QGLViewer/qglviewer.h>
#include <QMenu>

#ifdef WITH_QGLVIEWER
#include <QGLViewer/qglviewer.h>
typedef QGLViewer OpenGL_viewer_Superclass;
#else
#include <QGLWidget>
typedef QGLWidget OpenGL_viewer_Superclass;
#endif

Expand Down
1 change: 1 addition & 0 deletions apps/htrack_qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int main(int argc, char* argv[]) {

#if defined(OPENNI)
Camera camera(QVGA, 60 /*FPS*/);
// Camera camera(QVGA, 30 /*FPS*/);
SensorOpenNI sensor(&camera);
#endif

Expand Down
3 changes: 2 additions & 1 deletion cmake/ConfigureEigen.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIRS})
include_directories(${EIGEN3_INCLUDE_DIRS})
add_definitions(-DWITH_EIGEN)
3 changes: 1 addition & 2 deletions cmake/ConfigureQGLViewer.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#--- QGLViewer
find_package(QGLViewer REQUIRED)
find_package(QGLViewer) #<<< Optional
if(QGLVIEWER_FOUND)
include_directories(${QGLVIEWER_INCLUDE_DIR})
add_definitions(-DQGLVIEWER)
Expand Down
2 changes: 2 additions & 0 deletions cmake/FindOpenNI2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ find_path(OPENNI2_INCLUDE_DIR "OpenNI.h"
C:/Developer/include/openni
#--- LINUX (self deployed)
${CMAKE_SOURCE_DIR}/openni/include
${CMAKE_SOURCE_DIR}/../openni/include
DOC "OpenNI c++ interface header")

find_library(OPENNI2_LIBRARY "OpenNI2"
Expand All @@ -24,6 +25,7 @@ find_library(OPENNI2_LIBRARY "OpenNI2"
C:/Developer/lib
C:/Program Files/OpenNI2/Lib
${CMAKE_SOURCE_DIR}/openni/lib
${CMAKE_SOURCE_DIR}/../openni/lib
DOC "OpenNI2 library")

#message(STATUS "OPENNI2_LIBRARY: ${OPENNI2_LIBRARY}")
Expand Down
13 changes: 7 additions & 6 deletions tracker/Data/DataStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "util/qt2eigen.h"
#include "util/mylogger.h"
#include <algorithm>
#include <fstream>

DataStream::DataStream(Camera *camera) : _camera(camera){
assert( camera != NULL);
Expand All @@ -26,8 +27,8 @@ int DataStream::add_frame(const void* color_buffer, const void* depth_buffer){
/// Clone the data
if(color_buffer) frame.color = cv::Mat(height(), width(), CV_8UC3, (void*) color_buffer).clone();
if(depth_buffer) frame.depth = cv::Mat(height(), width(), CV_16UC1, (void*) depth_buffer).clone();
if(!color_buffer) qDebug() << "warning: null color buffer?";
if(!depth_buffer) qDebug() << "warning: null depth buffer?";
if(!color_buffer) mDebug() << "warning: null color buffer?";
if(!depth_buffer) mDebug() << "warning: null depth buffer?";

//#define TOMPSON_COLOR_IMAGE_FIX
#ifdef TOMPSON_COLOR_IMAGE_FIX
Expand All @@ -41,11 +42,11 @@ int DataStream::add_frame(const void* color_buffer, const void* depth_buffer){
DataFrame&DataStream::get_frame(int id){
// CHECK_BOUNDS(id, frames.size());
if(id < 0){
LOG(INFO) << "!!!WARNING frame_id out of bounds";
mWarning() << "frame_id out of bounds";
return *(frames.at(0));
}
if(id >= frames.size()){
LOG(INFO) << "!!!WARNING frame_id out of bounds";
mWarning() << "frame_id out of bounds";
return *(frames.at(frames.size()-1));
}
return *(frames.at(id));
Expand All @@ -55,7 +56,7 @@ DataFrame&DataStream::get_frame(int id){
void DataStream::crop(int start, int end){
CHECK_BOUNDS(start, 0, frames.size());
CHECK_BOUNDS(end, 0, frames.size());
CHECK(start<end) << "!start<end";
CHECK(start<end);

/// mark frame id as invalid in the range
for(int i=0; i<frames.size(); i++)
Expand All @@ -79,7 +80,7 @@ QString DataStream::get_basename()

void DataStream::save(QString path){
if(frames.size()==0){
qWarning() << "WANING: not saving an empty stream";
mWarning() << "WARNING: not saving an empty stream";
return;
}

Expand Down
2 changes: 1 addition & 1 deletion tracker/Data/SolutionStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SolutionStream{
}

void load(QString filename){
TIMED_SCOPE(timer,"SolutionStream::load()");
TICTOC_SCOPE(timer,"SolutionStream::load()");

std::string line;
std::ifstream in(filename.toStdString());
Expand Down
2 changes: 1 addition & 1 deletion tracker/HandFinder/HandFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void HandFinder::binary_classification(DataFrame& frame) {
_wristband_found = false;

// LOG(INFO) << "Worker::binary_classification";
TIMED_SCOPE(timer, "Worker::binary_classification");
// TICTOC_SCOPE(timer, "Worker::binary_classification");

cv::Mat& color = frame.color;
cv::Mat& depth = frame.depth;
Expand Down
18 changes: 9 additions & 9 deletions tracker/Sensor/Sensor_openni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int SensorOpenNI::initialize()
rc = kinect::OpenNI::initialize();
if(rc!=kinect::STATUS_OK)
{
qDebug()<<"Initialization Errors (if any): "<< kinect::OpenNI::getExtendedError();
mDebug()<<"Initialization Errors (if any): "<< kinect::OpenNI::getExtendedError();
kinect::OpenNI::shutdown();
exit(0);
}
Expand All @@ -68,7 +68,7 @@ int SensorOpenNI::initialize()
rc = device.open(deviceURI);
if (rc != kinect::STATUS_OK)
{
qDebug()<<"Device open failed: "<<kinect::OpenNI::getExtendedError();
mDebug()<<"Device open failed: "<<kinect::OpenNI::getExtendedError();
kinect::OpenNI::shutdown();
exit(0);
}
Expand All @@ -82,20 +82,20 @@ int SensorOpenNI::initialize()

if (rc != kinect::STATUS_OK)
{
qDebug()<<"Couldn't start depth stream: "<<kinect::OpenNI::getExtendedError();
mDebug()<<"Couldn't start depth stream: "<<kinect::OpenNI::getExtendedError();
g_depthStream.destroy();
exit(0);
}
}
else
{
qDebug()<<"Couldn't find depth stream: "<<kinect::OpenNI::getExtendedError();
mDebug()<<"Couldn't find depth stream: "<<kinect::OpenNI::getExtendedError();
exit(0);
}

if (!g_depthStream.isValid())
{
qDebug()<<"No valid depth streams. Exiting";
mDebug()<<"No valid depth streams. Exiting";
kinect::OpenNI::shutdown();
exit(0);
}
Expand All @@ -110,20 +110,20 @@ int SensorOpenNI::initialize()

if (rc != kinect::STATUS_OK)
{
qDebug()<<"Couldn't start color stream: "<<kinect::OpenNI::getExtendedError();
mDebug()<<"Couldn't start color stream: "<<kinect::OpenNI::getExtendedError();
g_colorStream.destroy();
exit(0);
}
}
else
{
qDebug()<<"Couldn't find color stream: "<<kinect::OpenNI::getExtendedError();
mDebug()<<"Couldn't find color stream: "<<kinect::OpenNI::getExtendedError();
exit(0);
}

if (!g_colorStream.isValid())
{
qDebug()<<"No valid color streams. Exiting";
mDebug()<<"No valid color streams. Exiting";
kinect::OpenNI::shutdown();
exit(0);
}
Expand Down Expand Up @@ -240,7 +240,7 @@ bool SensorOpenNI::fetch_streams(DataFrame &frame)
kinect::Status m_rc = device.setImageRegistrationMode(kinect::IMAGE_REGISTRATION_DEPTH_TO_COLOR);
if (m_rc != kinect::STATUS_OK)
{
qDebug()<<"Could not set Image Registration Mode";
mDebug()<<"Could not set Image Registration Mode";
kinect::OpenNI::shutdown();
exit(0);
}
Expand Down
5 changes: 1 addition & 4 deletions tracker/Sensor/Sensor_realsense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@


#ifndef HAS_REALSENSE
SensorRealSense::SensorRealSense(Camera *camera) : Sensor(camera){
LOG(INFO) << "Intel RealSense not available in your OS";
exit(0);
}
SensorRealSense::SensorRealSense(Camera *camera) : Sensor(camera){ mFatal() << "Intel RealSense not available in your OS"; }
int SensorRealSense::initialize(){ return 0; }
SensorRealSense::~SensorRealSense(){}
bool SensorRealSense::spin_wait_for_data(Scalar timeout_seconds){ return false; }
Expand Down
Loading

0 comments on commit 9126b47

Please sign in to comment.