Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for Raspberry Pi [Ubuntu Mate]
- Loading branch information
Adam
committed
Sep 30, 2018
1 parent
6e8f74d
commit 7d4cd68
Showing
87 changed files
with
16,636 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
cmake_minimum_required (VERSION 2.8.13) | ||
project (depth_eye) | ||
|
||
#set(CMAKE_INCLUDE_CURRENT_DIR 1) | ||
string(REPLACE "\n" "" SYSTEM_VERSION ${CMAKE_SYSTEM_VERSION}) | ||
|
||
string (REGEX REPLACE "^([0-9]+).*" "\\1" | ||
SYSTEM_MAJOR_VERSION "${SYSTEM_VERSION}") | ||
string (REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" | ||
SYSTEM_MINOR_VERSION "${SYSTEM_VERSION}") | ||
string (REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" | ||
SYSTEM_PATCH_VERSION ${SYSTEM_VERSION}) | ||
|
||
message("CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME} VERSION=${SYSTEM_VERSION}(${SYSTEM_MAJOR_VERSION}-${SYSTEM_MINOR_VERSION}-${SYSTEM_PATCH_VERSION})") | ||
message("ARCH = ${CMAKE_SYSTEM_PROCESSOR}") | ||
#set(CMAKE_SYSTEM_NAME "Linux") | ||
set(VOXEL_INCLUDE ./third_party/voxelsdk_ubuntu_mate/include/voxel-0.6.7) | ||
set(VOXEL_LIB ./third_party/voxelsdk_ubuntu_mate/lib) | ||
|
||
message("use Voxel SDK ${VOXEL_LIB}") | ||
message("use Voxel INCLUDE ${VOXEL_INCLUDE}") | ||
|
||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
#set(CMAKE_CXX_FLAGS "-msse2 -pthread -std=c++11 -fPIC -ffast-math") | ||
set(CMAKE_CXX_FLAGS "-pthread -std=c++11 -fPIC -ffast-math") | ||
set(COMMON_LIBS | ||
/usr/local/lib | ||
./lib) | ||
|
||
if(SYSTEM_MAJOR_VERSION STREQUAL "3") | ||
set(COMMON_INCLUDE | ||
/usr/include/libusb-1.0 | ||
./include/ | ||
${VOXEL_INCLUDE}) | ||
set(voxel ${VOXEL_LIB}) | ||
message("use Voxel SDK ${VOXEL_LIB}") | ||
else(SYSTEM_MAJOR_VERSION STREQUAL "4") | ||
set(COMMON_INCLUDE | ||
/usr/include/libusb-1.0 | ||
./include/ | ||
${VOXEL_INCLUDE}) | ||
set(voxel ${VOXEL_LIB}) | ||
message("use Voxel SDK ${VOXEL_LIB}") | ||
endif() | ||
|
||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") | ||
set(CMAKE_CXX_FLAGS "-msse2 -std=c++11 -fPIC -ffast-math") | ||
set(COMMON_LIBS | ||
/usr/local/lib | ||
./lib) | ||
set(COMMON_INCLUDE | ||
/usr/include/libusb-1.0 | ||
./include/ | ||
./third_party/voxelsdk_osx/include/voxel-0.6.7/ | ||
) | ||
set(voxel ./third_party/voxelsdk_osx/lib) | ||
message("use Voxel SDK ./third_party/voxelsdk_osx/lib") | ||
|
||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") | ||
set(CMAKE_CXX_FLAGS "-pthread -std=c++11 -fPIC -ffast-math") | ||
ADD_DEFINITIONS(-DANDROID) | ||
set(ANDROID_ABI armeabi-v7a) | ||
set(COMMON_INCLUDE | ||
./include/ | ||
./third_party/voxelsdk_android_jni/include/ | ||
./third_party/voxelsdk_android_jni/include/libusb/ | ||
./third_party/voxelsdk_android_jni/include/voxel-0.6.7/) | ||
set(LIBUSB_DIR ./third_party/voxelsdk_android_jni/lib/libusb/) | ||
add_library(usb-1.0 SHARED IMPORTED) | ||
set_target_properties(usb-1.0 PROPERTIES IMPORTED_LOCATION ${LIBUSB_DIR}/${ANDROID_ABI}/libusb1.0.so) | ||
set(COMMON_LIBS | ||
usb-1.0 | ||
dl) | ||
set(voxel ./third_party/voxelsdk_android_jni/lib/) | ||
message("use Voxel SDK ./third_party/voxelsdk_android_jni/lib/") | ||
|
||
else() | ||
message(FATAL_ERROR "This project not support platform:${CMAKE_SYSTEM_NAME}") | ||
endif() | ||
|
||
SET(BINDIR bin/) | ||
SET(LIBDIR lib/) | ||
SET(ARCDIR lib/) | ||
SET(SHAREDIR share/) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${ARCDIR}) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${LIBDIR}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${BINDIR}) | ||
|
||
include_directories(${COMMON_INCLUDE}) | ||
link_directories("/usr/local/lib" ${COMMON_LIBS} ${voxel}) | ||
|
||
#### Packaging related information -- common to both platforms | ||
set(CPACK_PACKAGE_NAME "Depth Eye SDK") | ||
set(CPACK_PACKAGE_VERSION "0.1") | ||
set(CPACK_PACKAGE_CONTACT "Developer@pointcloud.ai") | ||
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) | ||
set(CPACK_PACKAGE_VENDOR "pointcloud.ai") | ||
set(CPACK_SOURCE_GENERATOR "Developer") | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(test) |
77 changes: 77 additions & 0 deletions
77
third_party/voxelsdk_ubuntu_mate/include/voxel-0.6.7/CameraSystem.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* TI Voxel Lib component. | ||
* | ||
* Copyright (c) 2014 Texas Instruments Inc. | ||
*/ | ||
|
||
#ifndef VOXEL_CAMERASYSTEM_H | ||
#define VOXEL_CAMERASYSTEM_H | ||
|
||
#include <DepthCameraLibrary.h> | ||
#include "DownloaderFactory.h" | ||
|
||
namespace Voxel | ||
{ | ||
|
||
/** | ||
* \defgroup CamSys Camera System Components | ||
* @{ | ||
* \brief This group of classes provide the higher level API for cameras | ||
* @} | ||
*/ | ||
|
||
/** | ||
* \ingroup CamSys | ||
* | ||
* \brief This class provides ways to instantiate individual cameras and components like filters. | ||
*/ | ||
class VOXEL_EXPORT CameraSystem | ||
{ | ||
protected: | ||
Vector<DepthCameraLibraryPtr> _libraries; | ||
Map<String, DepthCameraFactoryPtr> _factories; // Key = device ID as returned by Device::id() | ||
Map<String, DepthCameraPtr> _depthCameras; // Key = device ID as returned by Device::id() | ||
|
||
Map<String, FilterFactoryPtr> _filterFactories; // Key = filter name | ||
|
||
Map<String, DownloaderFactoryPtr> _downloaderFactories;// Key = device ID as returned by Device::id() | ||
|
||
Map<GeneratorIDType, DepthCameraFactoryPtr> _factoryForGeneratorID; // Key = frame generator ID | ||
|
||
void _init(); | ||
|
||
void _loadLibraries(const Vector<String> &paths); | ||
|
||
public: | ||
CameraSystem(); | ||
|
||
bool addDepthCameraFactory(DepthCameraFactoryPtr factory); | ||
|
||
Vector<DevicePtr> scan(); | ||
|
||
DepthCameraPtr connect(const DevicePtr &device); | ||
// Remove local reference. Outside calling function should remove reference to its DepthCamera as well | ||
bool disconnect(const DepthCameraPtr &depthCamera, bool reset = false); | ||
|
||
|
||
|
||
bool addFilterFactory(FilterFactoryPtr filterFactory); | ||
|
||
Vector<String> getSupportedFilters(); | ||
bool getFilterDescription(const String &filterName, FilterDescription &description); | ||
FilterPtr createFilter(const String &name, DepthCamera::FrameType type); | ||
|
||
Vector<DevicePtr> getProgrammableDevices(); | ||
bool addDownloaderFactory(DownloaderFactoryPtr downloaderFactory); | ||
DownloaderPtr getDownloader(const DevicePtr &device); | ||
|
||
bool getFrameGenerator(uint8_t frameType, GeneratorIDType generatorID, FrameGeneratorPtr &frameGenerator); | ||
|
||
|
||
|
||
virtual ~CameraSystem(); | ||
}; | ||
|
||
} | ||
|
||
#endif // VOXEL_CAMERASYSTEM_H |
205 changes: 205 additions & 0 deletions
205
third_party/voxelsdk_ubuntu_mate/include/voxel-0.6.7/Common.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
/* | ||
* TI Voxel Lib component. | ||
* | ||
* Copyright (c) 2014 Texas Instruments Inc. | ||
*/ | ||
|
||
#ifndef VOXEL_COMMON_H | ||
#define VOXEL_COMMON_H | ||
|
||
#include <vector> | ||
#include <stdint.h> | ||
#include <string> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <unordered_map> | ||
#include <functional> | ||
#include <list> | ||
#include <set> | ||
#include <atomic> | ||
#include <cctype> | ||
|
||
#include <algorithm> | ||
|
||
#include <complex> | ||
|
||
#include <thread> | ||
|
||
#include <Ptr.h> | ||
|
||
#include <mutex> | ||
#include <condition_variable> | ||
|
||
#include "VoxelConfig.h" | ||
#include "VoxelExports.h" | ||
|
||
#if defined(_WIN32) || defined(APPLE) || defined(ANDROID) | ||
typedef uint32_t uint; | ||
#endif | ||
|
||
namespace Voxel | ||
{ | ||
|
||
/** | ||
* \defgroup Util Common and Utility classes | ||
* @{ | ||
*/ | ||
|
||
#ifndef SWIG | ||
template <typename T> | ||
using Vector = std::vector<T>; | ||
|
||
template <typename T> | ||
using List = std::list<T>; | ||
|
||
template <typename T> | ||
using Set = std::set<T>; | ||
|
||
template <typename K, typename V> | ||
using Map = std::unordered_map<K, V>; | ||
|
||
template <typename T> | ||
using Function = std::function<T>; | ||
|
||
template <typename T> | ||
using Atomic = std::atomic<T>; | ||
|
||
template <typename T> | ||
using Lock = std::unique_lock<T>; | ||
|
||
template <typename T> | ||
using shared_ptr = Ptr<T>; | ||
#else | ||
#define Vector std::vector | ||
#define List std::list | ||
#define Set std::set | ||
#define Map std::unordered_map | ||
#define Function std::function | ||
#define Atomic std::atomic | ||
#define Lock std::unique_lock | ||
#endif | ||
|
||
typedef std::string String; | ||
typedef int IndexType; | ||
typedef std::size_t SizeType; | ||
typedef uint8_t ByteType; | ||
typedef uint64_t TimeStampType; | ||
typedef uint32_t GeneratorIDType; | ||
typedef uint64_t FileOffsetType; | ||
|
||
|
||
typedef std::complex<float> Complex; | ||
typedef std::complex<double> ComplexDouble; | ||
|
||
typedef std::thread Thread; | ||
typedef Ptr<Thread> ThreadPtr; | ||
typedef std::mutex Mutex; | ||
typedef std::condition_variable ConditionVariable; | ||
|
||
typedef std::ifstream InputFileStream; | ||
typedef std::ofstream OutputFileStream; | ||
|
||
typedef std::istream InputStream; | ||
typedef std::ostream OutputStream; | ||
typedef std::ostringstream OutputStringStream; | ||
typedef std::istringstream InputStringStream; | ||
|
||
struct Version { uint8_t major, minor; }; | ||
|
||
/// String functions | ||
String VOXEL_EXPORT getHex(uint16_t value); | ||
void VOXEL_EXPORT split(const String &str, const char delimiter, Vector<String> &split); | ||
void VOXEL_EXPORT breakLines(const String &str, std::ostream &out, const uint maxPerLine, const String &newlinePrefix); | ||
|
||
/// Array handling template | ||
template<typename T, int sz> | ||
int arraySize(T(&)[sz]) | ||
{ | ||
return sz; | ||
} | ||
|
||
// Allocate in bytes and irrespective of size required by 'T'. This is useful if 'T' is has data structures which could have extendable elements. | ||
// E.g.: Windows USB device handling structures in usbioctl.h | ||
template <typename T> | ||
Ptr<T> byteAlloc(unsigned long sizeInBytes) | ||
{ | ||
return Ptr<T>((T *)new uint8_t[sizeInBytes], [](T *d) { delete[]((uint8_t *)d); }); | ||
} | ||
|
||
uint VOXEL_EXPORT gcd(uint n, uint m); | ||
|
||
// This returns nearest 'n = 2^m' such that 2^(m - 1) < value < 2^m | ||
unsigned int VOXEL_EXPORT nearestPowerOf2(unsigned int value, unsigned int &index); | ||
|
||
#define FLOAT_EPSILON 1E-5f | ||
|
||
inline bool floatEquals(float lhs, float rhs) | ||
{ | ||
if((lhs - rhs > FLOAT_EPSILON) || (rhs - lhs > FLOAT_EPSILON)) | ||
return false; | ||
else | ||
return true; | ||
} | ||
|
||
/** | ||
* @brief Left Trim | ||
* | ||
* Trims whitespace from the left end of the provided String | ||
* | ||
* @param[out] s The String to trim | ||
* | ||
* @return The modified String& | ||
*/ | ||
inline String& ltrim(String& s) { | ||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), | ||
std::ptr_fun<int, int>(std::isgraph))); | ||
return s; | ||
} | ||
|
||
/** | ||
* @brief Right Trim | ||
* | ||
* Trims whitespace from the right end of the provided String | ||
* | ||
* @param[out] s The String to trim | ||
* | ||
* @return The modified String& | ||
*/ | ||
inline String& rtrim(String& s) { | ||
s.erase(std::find_if(s.rbegin(), s.rend(), | ||
std::ptr_fun<int, int>(std::isgraph)).base(), s.end()); | ||
return s; | ||
} | ||
|
||
/** | ||
* @brief Trim | ||
* | ||
* Trims whitespace from both ends of the provided String | ||
* | ||
* @param[out] s The String to trim | ||
* | ||
* @return The modified String& | ||
*/ | ||
inline String& trim(String& s) { | ||
return ltrim(rtrim(s)); | ||
} | ||
|
||
/// Filesystem functions -- returns the number of files read or else -1 for error. Only those files whose name matches "matchString" partially (sub-string) are returned "files" | ||
int VOXEL_EXPORT getFiles(const String &dir, const String &matchString, Vector<String> &files); | ||
|
||
bool VOXEL_EXPORT isFilePresent(const String &filename); | ||
bool VOXEL_EXPORT isDirectory(const String &filename); | ||
bool VOXEL_EXPORT makeDirectory(const String &filename); | ||
String VOXEL_EXPORT dirname(const String &filename); | ||
String VOXEL_EXPORT basename(const String &filename); | ||
|
||
String VOXEL_EXPORT substitute(const String &s, const Vector<String> &keys, const Vector<String> &values); | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
} | ||
|
||
#endif //VOXEL_COMMON_H |
Oops, something went wrong.