diff --git a/config/README.MD b/config/README.MD new file mode 100644 index 0000000..6456342 --- /dev/null +++ b/config/README.MD @@ -0,0 +1,10 @@ +## SET USB Driver on Ubuntu/Linux +``` +sudo cp ./config/ubuntu/72-CalculusCDK.rules /etc/udev/rules.d/ +sudo cp ./config/ubuntu/60-SonyCDK.rules /etc/udev/rules.d/ + +sudo chmod a+x /etc/udev/rules.d/72-CalculusCDK.rules +sudo chmod a+x /etc/udev/rules.d/60-SonyCDK.rules.rules + +sudo udevadm control --reload +``` \ No newline at end of file diff --git a/config/ubuntu/60-SonyCDK.rules b/config/ubuntu/60-SonyCDK.rules new file mode 100644 index 0000000..f5a5d35 --- /dev/null +++ b/config/ubuntu/60-SonyCDK.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="9109", MODE="0666" + diff --git a/config/ubuntu/72-CalculusCDK.rules b/config/ubuntu/72-CalculusCDK.rules new file mode 100644 index 0000000..027ea6c --- /dev/null +++ b/config/ubuntu/72-CalculusCDK.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="9107", MODE="0666" + diff --git a/doc/ConfigurationFilesDescription.md b/doc/ConfigurationFilesDescription.md new file mode 100644 index 0000000..43512b5 --- /dev/null +++ b/doc/ConfigurationFilesDescription.md @@ -0,0 +1,108 @@ +SDK configuration files are of three types - + +1. Main configuration file +2. Camera profile configuration file +3. DML file + +All the configuration files are with an extension of ".conf". The format of a configuration file is same as the INI file format, with notable exceptions being + +Comments begin with '#' and not ';' +Double-quoted values are not supported. However, spaces in values are supported without double quotes. + +The conf file directory varies according to the system platform: +``` +libPointCloud/libs/macos/share/pointcloud-1.0.0/conf +libPointCloud/libs/ubuntu/share/pointcloud-1.0.0/conf +libPointCloud/libs/windows/share/pointcloud-1.0.0/conf +``` +## DML file +DML file which follows XML syntax, is a way by which all parameters valid for a depth camera are specified. + +## Main Configuration File +This consists of top level information for starting up a board such as DML file name, firmware file name (if any), etc. The name of this file is expected to exactly match the name assigned by the C++ class which handles this board. For instance, SonyCDK board has "SonyCDKCamera" as the assigned name in its C++ class, and its main configuration file is named as "SonyCDKCamera.conf". We provide a typical configuration here for reference. + +``` +[core] +dml = SONY556IMX.dml +camera_profiles = SonyCDKCameraNormal.conf +default_profile = 130 + +[observed_params] +tsensor = refresh:5 +tillum = refresh:5 +``` + +Here, the section 'core' consists of important information about + +* Camera profiles supported by this depth camera. This is via the key 'camera_profiles'. +* Default camera profile is specified via ID of the required camera profile. +* DML file name via 'dml' key. + +The main configuration may consist of other keys and sections too which are board specific. + +The 'observed_params' section is primarily for the benefit for PointCloudTool, which uses this information to periodically monitor some of the key parameters and checks for their validity. The format of this section is as follows. + +Key name is to match exactly the name of the parameter to be monitor. +Value is a semi-colon separated list of settings for monitoring. Each setting is a colon separated key-value pair. Supported settings are as follows. Note that all these settings are optional. +'refresh' with value being number of seconds. This is used to set the refresh rate for the parameter. Default value is voxel-viewer dependent. +'valid' with value being two hyphen separated numbers. This represents valid range of numbers. Typically this is used to notify user when parameter value falls outside this range. If not specified, all values of the parameter are treated to be valid. + +## Camera Profile Configuration File + +A camera profile defines various calibrations and parameter values to be used for running a depth camera. This is a handy of choosing various modes of operation for a depth camera. For instance, a camera profile could be defined for short range of operation of a depth camera, while another one for long range. Similarly, indoor or outdoor, etc. + +A camera profile is active and usable only when its file name is given in 'camera_profiles' key of 'core' section in the main configuration file. + +The format of this flexible to support variety of possible profiles. A typical configuration is presented below. + + +``` +[global] +id = 130 +name = Normal + +[defining_params] +#make sure to send this register at first after power-on = inck frequency[mhz] +unambiguous_range = 4.96 #7.45 +intg_time = 100 #100 +mod_freq1 = 60 +sub_rseq_lnum = 40 #40 #3 + +[params] +rngchken = 0 +dutof_mode = 0 #4 +hmax = 1800 #1900 #1388 #1700 #2304 +micr_lnum = 10000 #10000 #2500 +dpth_su_num = 30 +binning_mode = 0 #3 +phases_num = 8 + +dlycnt = 5 +anadlycnt = 14 #40 +dlycntsf = 0 # 10 + +[calib] +fy = 478 +fx = 478 +cx = 319 +cy = 239 +k1 = -0.0 +k2 = -0.0 +k3 = 0.00 +p1 = 0.00 +p2 = 0.00 +calib_disable = 14 #78 +actual_distance = 0.7 +tsensor_calib = 39 #60 +tillum_calib = 0 +phase_corr_2 = 0 +phase_corr_1 = -131 #69 #-194 +disable_offset_corr = 0 #0 +phasecorrection = file:SonyCDKCamera70cm8phase60mhzPhaseOffset.bin + +disable_temp_corr = 0 +coeff_illum = 0 +coeff_sensor = 5 +``` + +If you want to know more about the settings of this file, please contact us by mail dev@pointcloud.ai . \ No newline at end of file diff --git a/doc/DepthH3Introduction.md b/doc/DepthH3Introduction.md new file mode 100644 index 0000000..f313ea7 --- /dev/null +++ b/doc/DepthH3Introduction.md @@ -0,0 +1,49 @@ +## Simple Introduction +The Depth Eye H3 is a TOF base depth camera. It use the most high-end TOF sensor from Sony which provide 640X480 resolution. This module uses USB 3.0 cable with high versatility to pass all depth data including pointcloud. + +## Application Scenarios: +1. Gesture recognition +2. General robot navigation and localization +3. Environment scanning and 3D re-modeling +4. Service robot or industrial robot working for long hours +5. Home service /clean robot navigation and localization +6. General simultaneous localization and mapping (SLAM) +7. Smart toy's localization and obstacle avoidance +8. Face recognition +## Feature: +1. Amazing tiny size +2. USB 3.0 interface +3. Provide Pointcloud and RAW depth data +4. FOV(D* H*V ) :90 * 75 * 59 +5. 850nm band infrared VCSEL +6. Sony VGA TOF sensor +7. Supported platform : Ubuntu / Raspberry pi / Mac/ Windows + +## Specification +| Parameter | Desc | +|-------|:-------:| +| Dimensions | 76mm x76mm x41mm | +| Weight |G.W 190g | +| Battery |Exclude | +| Distance Range | 0.3~7 meters | +| FOV |G.W 190g | +| FPS |Max 30 FPS | +| Light source |850 VCSEL | +| Working temperature |0~50° | +| Typical power consumption | 5W | +| Communication Interface |USB 3.0 | +| OS | Wins7 abovce/Linux/Android/Mac/Ubuntu/Raspberry pi | +## Part List +| Item | quantity | +|-------|:-------:| +| Module | 1 | +| USB Cable | 1 | +## Documents +1. UserGuide-cPlus +2. UserGuide-Python +3. EnvironmentalConfiguration +4. FilterUsage +5. Examples(Gesture Control / DistanceMe) +6. Viewer Tool Guide + +Others please refer to github page. \ No newline at end of file diff --git a/doc/EnvironmentalConfiguration.md b/doc/EnvironmentalConfiguration.md new file mode 100644 index 0000000..d670528 --- /dev/null +++ b/doc/EnvironmentalConfiguration.md @@ -0,0 +1,33 @@ +# Environmental configuration for libPointCloud SDK +## Ubuntu +### Path Setting +Modify .bashrc to set environment variables: +``` +# vim ~/.bashrc +``` +add below source code to the end of bashrc file: +``` +export POINTCLOUD_SDK_PATH="/yourspath/libs/ubuntu" +export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib" +export PYTHONPATH=$POINTCLOUD_SDK_PATH/lib/python2.7 +``` +We need to make above changes come into effect: +``` +# source ~/.bashrc +``` +Finally, echo the constant to verify : +``` +# echo $POINTCLOUD_SDK_PATH +``` +### USB Driver Setting + +``` +sudo cp ./config/72-CalculusCDK.rules /etc/udev/rules.d/ +sudo cp ./config/60-SonyCDK.rules /etc/udev/rules.d/ + +sudo chmod a+x /etc/udev/rules.d/72-CalculusCDK.rules +sudo chmod a+x /etc/udev/rules.d/60-SonyCDK.rules.rules + +sudo udevadm control --reload +``` \ No newline at end of file diff --git a/doc/FilterUsage.md b/doc/FilterUsage.md new file mode 100644 index 0000000..74e51e0 --- /dev/null +++ b/doc/FilterUsage.md @@ -0,0 +1,83 @@ +# Filter Usage for libPointCloud SDK + +1. DarkPixFilter +2. DenoiseFilter +3. FlypixFilter +4. HDRFilter +5. IIRFilter +6. MedianFilter +7. TemporalMedianFilter +8. SmoothFilter +9. BilateralFilter + +## DarkPixFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| aThrNear | Amp Near Threshold | 0.0f | 4095.0f | +| phThrNear | Phase Near Threshold | 0.0f | 4095.0f | +| aThrFar | Amp Far Threshold | 0.0f | 4095.0f | +| phThrFar | Phase Far Threshold | 0.0f | 4095.0f | +| ambThresh | Ambient Threshold | 0.0f | 4095.0f | + +## DenoiseFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| order | Order of the filter | 2 | 100 | +| threshold | Threshold | 0 | 10000 | + +## FlypixFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| threshold | Gradient Threshold | 0 | 10000 | + +## HDRFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| order | Order of the filter | 2 | 100 | + +## IIRFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| gain | IIR gain coefficient | 0.0f | 1.0f | + +## MedianFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| stability | Stability factor | 0.0f | 1.0f | +| deadband | Dead band | 0.0f | 1.0f | +| deadbandStep | Dead band step | 0.0f | 1.0f | +| halfKernelSize | Half kernel size | 1 | 100| +| ambThresh | Ambient Threshold | 0.0f | 4095.0f | + +## TemporalMedianFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| order | Order of the filter | 1 | 100 | +| deadband | Dead band | 0.0f | 1.0f | + +## TemporalMedianFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| sigma | Standard deviation | 1 | 100 | +| deadband | Dead band | 0.0f | 1.0f | + +## SmoothFilter + + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| sigma | Standard deviation | 1 | 100 | + +## BilateralFilter + +| Parameter | Desc | Min | Max | +|-------|:---:|-----------|-------:| +| sigma | Standard deviation | 1 | 100 | diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000..c9ea1c9 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,18 @@ +# Index for documents + +## Environment setting +* [Environmental configuration for libPointCloud SDK](https://github.com/pointcloudAI/libPointCloud/blob/master/doc/EnvironmentalConfiguration.md) + +## Visualization tool +* [Visualization tool guide](https://github.com/pointcloudAI/libPointCloud/tree/master/tools/PointCloudTool) + +## Programming guide +* [Programming guide for c++](https://github.com/pointcloudAI/libPointCloud/blob/master/doc/UserGuide-cPlus.md) +* [Programming guide for Python](https://github.com/pointcloudAI/libPointCloud/blob/master/doc/UserGuide-Python.md) + +## Programming guide - common +* [Filter usage](https://github.com/pointcloudAI/libPointCloud/blob/master/doc/FilterUsage.md) +* [Configuration files description](https://github.com/pointcloudAI/libPointCloud/blob/master/doc/ConfigurationFilesDescription.md) + +## Programming guide - application +* [ROS Wrapper](https://github.com/pointcloudAI/libPointCloud/tree/master/wrappers/pointcloud_ros) diff --git a/doc/UserGuide-Python.md b/doc/UserGuide-Python.md new file mode 100644 index 0000000..e9b13f9 --- /dev/null +++ b/doc/UserGuide-Python.md @@ -0,0 +1,134 @@ +# libPointCloud SDK User Guide - Python version + +## 1. Connect to DepthCamera + +We use SWIG to generate Python bindings for the PointCloud library. All classes in the PointCoud library are available by doing: + +``` +import PointCloud +``` +Now, we can list all available devices: +``` +import PointCloud +cameraSystem = PointCloud.CameraSystem() +devices = cameraSystem.scan() + +for d in devices: + print d.id() +``` + +To connect to the first detected depth camera, +``` +if len(devices) == 0: + print "No availale device" + sys.exit(1) + +depthCamera = cameraSystem.connect(devices[0]) + +``` +Then , we can start the camera now: +``` +if depthCamera: + depthCamera.clearAllCallbacks() + depthCamera.registerCallback(PointCloud.DepthCamera.FRAME_DEPTH_FRAME, processDepthFrame) + print 'DepthCamera ID = ', depthCamera.id() + if not depthCamera.start(): + print("start fail") + else: + print("\n start ok") + print("chipset : %s " %depthCamera.chipset() ) + +depthCamera.stop() +cameraSystem.disconnect(depthCamera, True) +del cameraSystem +sys.exit(1) +``` + +## 2. Getter and setter of Main Parameters + +1. Modulation frequency +2. Integration time +3. FOV +4. FPS +5. Resolution + +### Modulation frequency getter & setter + +``` +#Set Modulation frequency +if depthCamera.chipset() == CHIPSET_CALCULUS: + r0 = depthCamera.setf("mod_freq1",24) +elif (depthCamera.chipset() == CHIPSET_SONY556): + r0 = depthCamera.seti("mod_freq1",20) + +print(" ||| Set frequency result: %s " %r0) + + +#Get Modulation frequency +if depthCamera.chipset() == CHIPSET_CALCULUS: + r0,mod_freq = depthCamera.getf("mod_freq1") +elif (depthCamera.chipset() == CHIPSET_SONY556): + r0,mod_freq = depthCamera.geti("mod_freq1") + +print(" ||| Modulation frequency : %s MHz" %mod_freq) +``` +### Integration time getter & setter +``` +#Set integration time +r0,intg_time = depthCamera.setu("intg_time",6) +print(" ||| Set integration time result: %s" %r0) + +#Get integration time +r0,intg_time = depthCamera.getu("intg_time") +print(" ||| integration time : %s %% " %intg_time) +``` +### FOV Getter +``` +#get FOV +r0,fov = depthCamera.getFieldOfView() +print(" ||| FOV : %f ° " %float(fov*100)) +``` +### FPS Getter & Setter +``` +#get FPS +r0,rate = depthCamera.getFrameRate() +print(" ||| FPS : %s @FPS "%int(rate.getFrameRate()) ) + +#Set FPS +rate.numerator = 15; +r0 = depthCamera.setFrameRate(rate) +print(" ||| set FPS result : %s "%r0) + +#get FPS once more +r0,rate = depthCamera.getFrameRate() +print(" ||| New FPS : %s @FPS "%int(rate.getFrameRate()) ) +``` +### Resolution Getter +``` +#get framesize/resolution +r0,frameSize = depthCamera.getFrameSize() +print(" ||| resolution: %d x %d" %(frameSize.width,frameSize.height)) +``` +## 3. Add filter + +``` +CameraSystem sys; +FilterPtr fp = sys.createFilter("PointCloud::IIRFilter", DepthCamera::FRAME_RAW_FRAME_PROCESSED); + +fp->set("gain", 0.2f); + +if(!fp) +{ +logger(LOG_ERROR) << "Failed to get IIRFilter" << std::endl; +return -1; +}else{ + std::cout << " ||| Successfully createFilter IIRFilter " << std::endl; + +} + +int position = depthCamera->addFilter(fp, DepthCamera::FRAME_RAW_FRAME_PROCESSED); + +std::cout << " ||| Successfully add IIRFilter at "<< position << std::endl; + +``` +More filter usage please refer to Filter usage documents diff --git a/doc/UserGuide-cPlus.md b/doc/UserGuide-cPlus.md new file mode 100644 index 0000000..7bfa853 --- /dev/null +++ b/doc/UserGuide-cPlus.md @@ -0,0 +1,146 @@ +# libPointCloud SDK User Guide - C++ version + +## 1. Connect to DepthCamera + +All classes in the PointCoud library are available by doing: + +``` +#include "CameraSystem.h" +using namespace PointCloud; +``` +Now,, in main(), do the following to list all available devices: +``` +CameraSystem sys; +DevicePtr device; +const Vector &devices = sys.scan(); +bool found = false; +for (auto &d: devices){ + logger(LOG_INFO) << " ||| Detected devices: " << d->id() << std::endl; + device = d; + found = true; +} +``` +To connect to the first detected depth camera, +``` +DepthCameraPtr depthCamera; +depthCamera = sys.connect(device); + if (!depthCamera) { + logger(LOG_ERROR) << " ||| Could not load depth camera for device "<< device->id() << std::endl; + return 1; +} +``` +Then , we can start the camera now: +``` +if (!depthCamera->isInitialized()) { + logger(LOG_ERROR) << " ||| Depth camera not initialized for device "<< device->id() << std::endl; + return 1; +} +// Must register one callback before starting capture +//depthCamera->registerCallback(DepthCamera::FRAME_RAW_FRAME_PROCESSED,rawdataCallback); +depthCamera->registerCallback(DepthCamera::FRAME_RAW_FRAME_PROCESSED, [&](DepthCamera &dc, const Frame &frame, DepthCamera::FrameType c) { + logger(LOG_INFO) << " ||| on registerCallback" << std::endl; +}); + +if(depthCamera->start()){ + logger(LOG_INFO) << " ||| start camera pass" << std::endl; +}else{ + logger(LOG_INFO) << " ||| start camera fail" << std::endl; +} +std::cout << "Press any key to quit" << std::endl; +getchar(); + +// Stop Camera +depthCamera->stop(); +sys.disconnect(depthCamera,true); +return 0; +``` + +## 2. Getter and setter of Main Parameters + +1. Modulation frequency +2. Integration time +3. FOV +4. FPS +5. Resolution + +### Modulation frequency getter & setter + +``` +#Set Modulation frequency +float mod_freq1 ; +mod_freq1 = 12; +depthCamera->set("mod_freq1",mod_freq1); + +#Get Modulation frequency +depthCamera->get("mod_freq1",mod_freq1); +logger(LOG_INFO) << " ||| Modulation frequency : " << mod_freq1 << std::endl; +``` +### Integration time getter & setter +``` +#Set integration time +unsigned int intg_time ; +intg_time = 6; +depthCamera->set("intg_time",intg_time); + +#Get integration time +depthCamera->get("intg_time",intg_time); +logger(LOG_INFO) << " ||| INTG_TIME : " << intg_time << std::endl; +``` +### FOV Getter +``` +#get FOV +float angle ; +depthCamera->getFieldOfView(angle); +logger(LOG_INFO) << " ||| FOV : " << angle << std::endl; +``` +### FPS Getter & Setter +``` +#Set FPS +FrameRate r; +r.numerator = 15; +depthCamera->setFrameRate(r); +#Get FPS +if(depthCamera->getFrameRate(r)) + logger(LOG_INFO) << " ||| Capturing at a frame rate of " << r.getFrameRate() << " fps" << std::endl; +``` +### Resolution Getter +``` +#get framesize/resolution +r0,frameSize = depthCamera.getFrameSize() +print(" ||| resolution: %d x %d" %(frameSize.width,frameSize.height)) +``` +## 3. Frame call back +Valid frame types are: +``` +DepthCamera::FRAME_RAW_FRAME_UNPROCESSED +DepthCamera::FRAME_RAW_FRAME_PROCESSED +DepthCamera::FRAME_DEPTH_FRAME +DepthCamera::FRAME_XYZI_POINT_CLOUD_FRAME +``` +Callback function needs of the following signature: +``` +void callbackfunction(DepthCamera &dc, const Frame &frame, DepthCamera::FrameType c); +``` +## 3. Add filter + +``` +CameraSystem sys; +FilterPtr fp = sys.createFilter("PointCloud::IIRFilter", DepthCamera::FRAME_RAW_FRAME_PROCESSED); + +fp->set("gain", 0.2f); + +if(!fp) +{ +logger(LOG_ERROR) << "Failed to get IIRFilter" << std::endl; +return -1; +}else{ + std::cout << " ||| Successfully createFilter IIRFilter " << std::endl; + +} + +int position = depthCamera->addFilter(fp, DepthCamera::FRAME_RAW_FRAME_PROCESSED); + +std::cout << " ||| Successfully add IIRFilter at "<< position << std::endl; + +``` +More filter usage please refer to Filter usage documents \ No newline at end of file diff --git a/doc/image/ros_imx556_sample.gif b/doc/image/ros_imx556_sample.gif new file mode 100644 index 0000000..4bf1395 Binary files /dev/null and b/doc/image/ros_imx556_sample.gif differ diff --git a/doc/image/snapshotAcsii.jpg b/doc/image/snapshotAcsii.jpg new file mode 100644 index 0000000..3bd74af Binary files /dev/null and b/doc/image/snapshotAcsii.jpg differ diff --git a/doc/image/snapshotFrequentlyUsed.jpg b/doc/image/snapshotFrequentlyUsed.jpg new file mode 100644 index 0000000..020893c Binary files /dev/null and b/doc/image/snapshotFrequentlyUsed.jpg differ diff --git a/doc/image/snapshotIR.jpg b/doc/image/snapshotIR.jpg new file mode 100644 index 0000000..941c927 Binary files /dev/null and b/doc/image/snapshotIR.jpg differ diff --git a/doc/image/snapshotMain.jpg b/doc/image/snapshotMain.jpg new file mode 100644 index 0000000..d820235 Binary files /dev/null and b/doc/image/snapshotMain.jpg differ diff --git a/doc/image/snapshotParameters.jpg b/doc/image/snapshotParameters.jpg new file mode 100644 index 0000000..13867f1 Binary files /dev/null and b/doc/image/snapshotParameters.jpg differ diff --git a/doc/image/snapshotPhase.jpg b/doc/image/snapshotPhase.jpg new file mode 100644 index 0000000..cd1c611 Binary files /dev/null and b/doc/image/snapshotPhase.jpg differ diff --git a/doc/image/snapshotPointCloudAction.jpg b/doc/image/snapshotPointCloudAction.jpg new file mode 100644 index 0000000..ee5f6b4 Binary files /dev/null and b/doc/image/snapshotPointCloudAction.jpg differ diff --git a/doc/image/snapshotStatusBar.jpg b/doc/image/snapshotStatusBar.jpg new file mode 100644 index 0000000..2540f32 Binary files /dev/null and b/doc/image/snapshotStatusBar.jpg differ diff --git a/doc/image/snapshotToolbar.jpg b/doc/image/snapshotToolbar.jpg new file mode 100644 index 0000000..b28068e Binary files /dev/null and b/doc/image/snapshotToolbar.jpg differ diff --git a/doc/image/snapshotWatchList.jpg b/doc/image/snapshotWatchList.jpg new file mode 100644 index 0000000..b0c7de7 Binary files /dev/null and b/doc/image/snapshotWatchList.jpg differ diff --git a/libs/macos/README.md b/libs/macos/README.md new file mode 100644 index 0000000..e69de29 diff --git a/libs/macos/include/pointcloud-1.0.0/CameraSystem.h b/libs/macos/include/pointcloud-1.0.0/CameraSystem.h new file mode 100644 index 0000000..617ab96 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/CameraSystem.h @@ -0,0 +1,62 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_CAMERASYSTEM_H +#define POINTCLOUD_CAMERASYSTEM_H + +#include +#include + +namespace PointCloud +{ +class POINTCLOUD_EXPORT DepthCameraLibrary; +class POINTCLOUD_EXPORT DepthCameraFactory; +typedef Ptr DepthCameraLibraryPtr; +typedef Ptr DepthCameraFactoryPtr; +/** + * \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 POINTCLOUD_EXPORT CameraSystem +{ +public: + CameraSystem(); + virtual ~CameraSystem(); + Vector scan(); + DepthCameraPtr connect(const DevicePtr &device); + bool disconnect(const DepthCameraPtr &depthCamera, bool reset = false); + bool addDepthCameraFactory(DepthCameraFactoryPtr factory); + bool addFilterFactory(FilterFactoryPtr filterFactory); + Vector getSupportedFilters(); + bool getFilterDescription(const String &filterName, FilterDescription &description); + FilterPtr createFilter(const String &name, DepthCamera::FrameType type); + bool getFrameGenerator(uint8_t frameType, GeneratorIDType generatorID, FrameGeneratorPtr &frameGenerator); + //Vector getProgrammableDevices(); + //bool addDownloaderFactory(DownloaderFactoryPtr downloaderFactory); + //DownloaderPtr getDownloader(const DevicePtr &device); +protected: + void _init(); + void _loadLibraries(const Vector &paths); +protected: + Vector _libraries; + Map _factories; // Key = device ID as returned by Device::id() + Map _depthCameras; // Key = device ID as returned by Device::id() + Map _filterFactories; // Key = filter name + //Map _downloaderFactories;// Key = device ID as returned by Device::id() + Map _factoryForGeneratorID; // Key = frame generator ID +}; + +} + +#endif // POINTCLOUD_CAMERASYSTEM_H diff --git a/libs/macos/include/pointcloud-1.0.0/Common.h b/libs/macos/include/pointcloud-1.0.0/Common.h new file mode 100644 index 0000000..0f5d09e --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Common.h @@ -0,0 +1,207 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_COMMON_H +#define POINTCLOUD_COMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include + +#include +#include + +#include "PointCloudConfig.h" +#include "PointCloudExports.h" + +#if defined(_WIN32) || defined(APPLE) || defined(ANDROID) +typedef uint32_t uint; +#else +typedef unsigned int uint; +#endif + +namespace PointCloud +{ + +/** + * \defgroup Util Common and Utility classes + * @{ + */ + +#ifndef SWIG +template +using Vector = std::vector; + +template +using List = std::list; + +template +using Set = std::set; + +template +using Map = std::unordered_map; + +template +using Function = std::function; + +template +using Atomic = std::atomic; + +template +using Lock = std::unique_lock; + +template +using shared_ptr = Ptr; +#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 Complex; +typedef std::complex ComplexDouble; + +typedef std::thread Thread; +typedef Ptr 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 POINTCLOUD_EXPORT getHex(uint16_t value); +void POINTCLOUD_EXPORT split(const String &str, const char delimiter, Vector &split); +void POINTCLOUD_EXPORT breakLines(const String &str, std::ostream &out, const uint maxPerLine, const String &newlinePrefix); + +/// Array handling template +template +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 +Ptr byteAlloc(unsigned long sizeInBytes) +{ + return Ptr((T *)new uint8_t[sizeInBytes], [](T *d) { delete[]((uint8_t *)d); }); +} + +uint POINTCLOUD_EXPORT gcd(uint n, uint m); + +// This returns nearest 'n = 2^m' such that 2^(m - 1) < value < 2^m +unsigned int POINTCLOUD_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(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(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 POINTCLOUD_EXPORT getFiles(const String &dir, const String &matchString, Vector &files); + +bool POINTCLOUD_EXPORT isFilePresent(const String &filename); +bool POINTCLOUD_EXPORT isDirectory(const String &filename); +bool POINTCLOUD_EXPORT makeDirectory(const String &filename); +String POINTCLOUD_EXPORT dirname(const String &filename); +String POINTCLOUD_EXPORT basename(const String &filename); + +String POINTCLOUD_EXPORT substitute(const String &s, const Vector &keys, const Vector &values); + +/** + * @} + */ + +} + +#endif //POINTCLOUD_COMMON_H diff --git a/libs/macos/include/pointcloud-1.0.0/Configuration.h b/libs/macos/include/pointcloud-1.0.0/Configuration.h new file mode 100644 index 0000000..07466bc --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Configuration.h @@ -0,0 +1,506 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_CONFIGURATION_H +#define POINTCLOUD_CONFIGURATION_H + +#include "Common.h" +#include "DataPacket.h" +//#include "HardwareSerializer.h" + +#define FILE_PREFIX "file:" + +#define CALIB_DISABLE "calib_disable" + +namespace PointCloud +{ + +/** + * \ingroup Util + */ + +struct SDKVersion +{ + uint8_t major, minor, patch, abi, conf; +}; + +class POINTCLOUD_EXPORT Configuration +{ +protected: + struct _Path + { + String installPath; + String environmentVariable; + }; + + String _sdkPath; + String _sdkVersion; + + Vector _pathKeys; + Vector _pathValues; + + static const Map _pathTypes; + + bool _getPaths(const String &type, Vector &paths); + + bool _get(const String &type, String &name); + + static bool _addPath(const String &type, const String &path); + +public: + static SDKVersion getSDKVersion(); + + Configuration(); + + inline bool getFirmwarePaths(Vector &paths) { return _getPaths("fw", paths); } + inline bool getConfPaths(Vector &paths) { return _getPaths("conf", paths); } + inline bool getLibPaths(Vector &paths) { return _getPaths("lib", paths); } + + inline static bool addFirmwarePath(const String &path) { return _addPath("fw", path); } + inline static bool addConfPath(const String &path) { return _addPath("conf", path); } + inline static bool addLibPath(const String &path) { return _addPath("lib", path); } + static bool addPathToEnvironmentVariable(const String &environmentVariable, const String &path, bool prepend = true); + + inline static bool getEnvironmentVariable(const String &environmentVariable, String &value) + { + char *p = getenv(environmentVariable.c_str()); + if(p) { value = p; return true; } + return false; + } + + static bool setEnvironmentVariable(const String &environmentVariable, const String &value); + + inline static bool setSDKPath(const String &path) { return setEnvironmentVariable("POINTCLOUD_SDK_PATH", path); } + inline static bool getSDKPath(String &path) { return getEnvironmentVariable("POINTCLOUD_SDK_PATH", path); } + + bool getLocalPath(const String &type, String &path); + inline bool getLocalFirmwarePath(String &path) { return getLocalPath("fw", path); } + inline bool getLocalConfPath(String &path) { return getLocalPath("conf", path); } + inline bool getLocalLibPath(String &path) { return getLocalPath("lib", path); } + + bool getLocalFile(const String &type, String &fileName); + inline bool getLocalFirmwareFile(String &fileName) { return getLocalFile("fw", fileName); } + inline bool getLocalConfFile(String &fileName) { return getLocalFile("conf", fileName); } + inline bool getLocalLibFile(String &fileName) { return getLocalFile("lib", fileName); } + + /// Updates "name" to full path + inline bool getConfFile(String &fileName) { return _get("conf", fileName); } + inline bool getFirmwareFile(String &fileName) { return _get("fw", fileName); } + inline bool geLibFile(String &fileName) { return _get("lib", fileName); } + +}; + +class ConfigurationFile; + +class POINTCLOUD_EXPORT ConfigSet +{ +protected: + bool _get(const String &name, String &value) const; + bool _set(const String &name, const String &value); + +public: + Map params; + Vector paramNames; + + bool remove(const String &name); + + bool isEmpty() { return params.size() == 0; } + + bool isPresent(const String &name) const; + String get(const String &name) const; + int getInteger(const String &name) const; + float getFloat(const String &name) const; + bool getBoolean(const String &name) const; + + bool set(const String &name, const String &value); + bool setInteger(const String &name, int value); + bool setFloat(const String &name, float value); + bool setBoolean(const String &name, bool value); + + friend class ConfigurationFile; +}; + +struct ConfigDataPacket: public DataPacket +{ + enum PacketType + { + PACKET_CONFIG = 0, + PACKET_2D_DATA_FILE = 1 + }; + + ConfigDataPacket(): DataPacket() {} +}; + +class MainConfigurationFile; + +class POINTCLOUD_EXPORT ConfigurationFile +{ +protected: + bool _get(const String §ion, const String &name, String &value) const; + bool _set(const String §ion, const String &name, const String &value); + + String _fileName; + + Map> _dataFiles; + + MainConfigurationFile *_mainConfigurationFile; + + int _id, _parentID; + String _profileName; + + mutable Mutex _mutex; + + bool _serializeAllDataFiles(OutputStream &out); + bool _saveAllDataFiles(const String &prefix); + + template + bool _getData(const String &fileName, Vector &data); + + template + bool _setData(const String &fileName, const Vector &data); + + bool _copyFromParentIfNotPresent(ConfigurationFile *other, bool recurse = true); + +public: + typedef Map ConfigSetMap; + + enum Location + { + IN_HOST = 0, + IN_CAMERA = 1 + }; + +protected: + Location _location; + +public: + ConfigSetMap configs; + + inline Location getLocation() const { return _location; } + inline int getID() const { return _id; } + inline int getParentID() const { return _parentID; } + inline const String &getProfileName() const { return _profileName; } + + virtual bool isPresent(const String §ion, const String &name, bool includeParent = true) const; + virtual String get(const String §ion, const String &name) const; + + inline void setProfileName(const String &name) { _profileName = name; set("global", "name", name); } + inline void setID(const int id) { _id = id; setInteger("global", "id", id); } + inline void setParentID(const int id) { _parentID = id; setInteger("global", "parent", id); } + + template + bool getFile(const String §ion, const String &name, String &fileName, Vector &data); + + int getInteger(const String §ion, const String &name) const; + float getFloat(const String §ion, const String &name) const; + bool getBoolean(const String §ion, const String &name) const; + + virtual bool set(const String §ion, const String &name, const String &value); + + template + bool setFile(const String §ion, const String &name, const String &fileName, const Vector &data); + + bool setInteger(const String §ion, const String &name, int value); + bool setFloat(const String §ion, const String &name, float value); + bool setBoolean(const String §ion, const String &name, bool value); + + bool remove(const String §ion, const String &name); + bool removeSection(const String §ion); + + virtual bool getConfigSet(const String §ion, const ConfigSet *&configSet, bool includeParent = true) const; + + virtual bool read(const String &configFile); + virtual bool read(InputStream &in); + + virtual bool write(const String &configFile = ""); + virtual bool write(OutputStream &out); + + bool isValidCameraProfile(); + + virtual bool removeFile(); + + inline void clear() { Lock _(_mutex); configs.clear(); } + + inline const String &getConfigFileName() { return _fileName; } + + ConfigurationFile(): ConfigurationFile(0) {} + ConfigurationFile(MainConfigurationFile *mainConfigurationFile): + _mainConfigurationFile(mainConfigurationFile), _id(-1), _parentID(-1), _location(IN_HOST) {} + + ConfigurationFile(const ConfigurationFile &other) + { + operator =(other); + } + + inline ConfigurationFile &operator =(const ConfigurationFile &other) + { + configs = other.configs; + _fileName = other._fileName; + _mainConfigurationFile = other._mainConfigurationFile; + _id = other._id; + _profileName = other._profileName; + _parentID = other._parentID; + _location = other._location; + _dataFiles = other._dataFiles; + return *this; + } + + inline bool mergeParentConfiguration() + { + return _copyFromParentIfNotPresent(this); + } + + inline ConfigurationFile ©(const ConfigurationFile &other) + { + return operator =(other); + } + + virtual ~ConfigurationFile() {} + + friend class MainConfigurationFile; +}; + +template +bool ConfigurationFile::getFile(const String §ion, const String &name, String &fileName, Vector &data) +{ + String v = get(section, name); + + if(v.compare(0, sizeof(FILE_PREFIX) - 1, FILE_PREFIX) != 0 || v.size() <= sizeof(FILE_PREFIX) - 1) + { + logger(LOG_ERROR) << "ConfigurationFile: section = " << section << ", name = " << name << ", is not a file type." << std::endl; + return false; + } + + fileName = v.substr(sizeof(FILE_PREFIX) - 1); + + return _getData(fileName, data); +} + +template +bool ConfigurationFile::setFile(const String §ion, const String &name, const String &fileName, const Vector &data) +{ + return _setData(fileName, data) && set(section, name, "file:" + fileName); +} + +template +bool ConfigurationFile::_setData(const String &fileName, const Vector &data) +{ + Configuration c; + + String f = fileName; + if(!c.getLocalConfFile(f)) + { + logger(LOG_ERROR) << "ConfigurationFile: Failed to locate file '" << fileName << "'" << std::endl; + return false; + } + + OutputFileStream fs(f, std::ios::out | std::ios::binary); + + if(!fs.good()) + { + logger(LOG_ERROR) << "ConfigurationFile: Could not open file '" << fileName << "'" << std::endl; + return false; + } + + fs.write((const char *)data.data(), data.size()*sizeof(T)); + + fs.close(); + + _dataFiles[fileName].resize(data.size()*sizeof(T)); + + memcpy(_dataFiles[fileName].data(), data.data(), data.size()*sizeof(T)); + + return true; +} + +struct CalibrationInformation +{ + String name; + int id; + Vector definingParameters; + Vector calibrationParameters; +}; + +class POINTCLOUD_EXPORT MainConfigurationFile: public ConfigurationFile +{ +protected: + Map _cameraProfiles; + Map _cameraProfileNames; + int _defaultCameraProfileID, _defaultCameraProfileIDInHardware; + int _currentCameraProfileID; + ConfigurationFile *_currentCameraProfile; + + bool _updateCameraProfileList(); + + String _mainConfigName, _hardwareID; + + int _getNewCameraProfileID(bool inHost = true); + + bool _saveHardwareImage(Version &version, TimeStampType ×tamp, SerializedObject &so); + + //HardwareSerializerPtr _hardwareSerializer; + + int _quantizationFactor; + + Map _calibrationInformation; + + bool _removeCameraProfile(const int id, bool updateHardware = true); + bool _saveCameraProfileToHardware(int &id, Vector &newIDsAdded, Vector &oldIDsModified, bool saveParents = false, bool updateHardware = true, bool setAsDefault = false, const String &namePrefix = ""); + bool _rollbackCameraProfiles(const Vector &newIDsAdded, const Vector &oldIDsModified); + +public: + MainConfigurationFile(const String &name, const String &hardwareID, int quantizationFactor = 4/*, HardwareSerializerPtr hardwareSerializer = nullptr*/): + _currentCameraProfile(nullptr), _defaultCameraProfileID(-1), _defaultCameraProfileIDInHardware(-1), _mainConfigName(name), /*_hardwareSerializer(hardwareSerializer),*/ + _quantizationFactor(quantizationFactor) + { + //if(!hardwareSerializer) + // _hardwareSerializer = HardwareSerializerPtr(new HardwareSerializer()); + } + + void setSerializationQuantizationFactor(int quantizationFactor) { _quantizationFactor = quantizationFactor; } + + virtual bool read(const String &configFile); + + bool readFromHardware(); + bool writeToHardware(); + + inline bool hasHardwareConfigurationSupport() { return false; + //_hardwareSerializer && *_hardwareSerializer; + } + + //inline void setHardwareConfigSerializer(const HardwareSerializerPtr &hardwareSerializer) { _hardwareSerializer = hardwareSerializer; } + + virtual String get(const String §ion, const String &name) const; + virtual bool isPresent(const String §ion, const String &name, bool includeParent = true) const; + + int addCameraProfile(const String &profileName, const int parentID = -1); + bool setCurrentCameraProfile(const int id); + bool removeAllHardwareCameraProfiles(); + bool removeCameraProfile(const int id); + bool saveCameraProfileToHardware(int &id, bool saveParents = false, bool setAsDefault = false, const String &namePrefix = ""); + + ConfigurationFile *getDefaultCameraProfile(); + ConfigurationFile *getCameraProfile(const int id); + + template + bool getFile(const String §ion, const String &name, String &fileName, Vector &data); + + inline int getDefaultCameraProfileID() + { + if(_defaultCameraProfileIDInHardware >= 0) + return _defaultCameraProfileIDInHardware; + else + return _defaultCameraProfileID; + } + + inline int getDefaultCameraProfileIDInHost() + { + return _defaultCameraProfileID; + } + + inline int getDefaultCameraProfileIDInCamera() + { + return _defaultCameraProfileIDInHardware; + } + + /// This only removes the default ID from hardware and not the profile itself + bool removeDefaultCameraProfileIDInCamera(); + + bool setDefaultCameraProfile(const int id); + + inline void setHardwareID(const String &hwID) { _hardwareID = hwID; } + + inline int getCurrentProfileID() { return _currentCameraProfileID; } + + bool getCameraProfileName(const int id, String &cameraProfileName); + + inline const Map &getCameraProfileNames() { return _cameraProfileNames; } + + inline const Map &getCalibrationInformation() const { return _calibrationInformation; } + + virtual ~MainConfigurationFile() {} + + friend class ConfigurationFile; + friend class DepthCamera; +}; + +template +bool ConfigurationFile::_getData(const String &fileName, Vector &data) +{ + bool loadFromFile = false; + if(_dataFiles.find(fileName) == _dataFiles.end()) + { + if(_mainConfigurationFile && _parentID >= 0) + { + ConfigurationFile *parentConfig = _mainConfigurationFile->getCameraProfile(_parentID); + + // TODO This does not handle circular references between profiles + if(parentConfig && parentConfig->_getData(fileName, data)) + return true; + else + loadFromFile = true; + } + else + loadFromFile = true; + } + + if(loadFromFile) + { + Configuration c; + + String f = fileName; + if(!c.getConfFile(f)) + { + logger(LOG_ERROR) << "ConfigurationFile: Could not locate file '" << fileName << "'" << std::endl; + return false; + } + + InputFileStream fs(f, std::ios::in | std::ios::binary | std::ios::ate); + + if(!fs.good()) + { + logger(LOG_ERROR) << "ConfigurationFile: Could not open file '" << fileName << "'" << std::endl; + return false; + } + + int size = fs.tellg(); + + if(size == 0) + { + logger(LOG_ERROR) << "ConfigurationFile: Null config data '" << f << "'" << std::endl; + return false; + } + + Vector &d = _dataFiles[fileName]; + + d.resize(size); + fs.seekg(std::ios::beg); + fs.clear(); + fs.read((char *)d.data(), size); + } + + Vector &d = _dataFiles[fileName]; + + data.resize((d.size() + sizeof(T)/2)/sizeof(T)); + + memcpy(data.data(), d.data(), d.size()); + + return true; +} + +template +bool MainConfigurationFile::getFile(const String §ion, const String &name, String &fileName, Vector &data) +{ + if(!_currentCameraProfile || !_currentCameraProfile->getFile(section, name, fileName, data)) + return ConfigurationFile::getFile(section, name, fileName, data); + else + return true; +} + + +} + +#endif // CONFIGURATION_H diff --git a/libs/macos/include/pointcloud-1.0.0/DataPacket.h b/libs/macos/include/pointcloud-1.0.0/DataPacket.h new file mode 100644 index 0000000..8acf3bc --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/DataPacket.h @@ -0,0 +1,46 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DATA_PACKET_H +#define POINTCLOUD_DATA_PACKET_H + +#include "Common.h" +#include "SerializedObject.h" + +#include "Logger.h" + +namespace PointCloud +{ + +struct POINTCLOUD_EXPORT DataPacket +{ + char magic[6]; // + + uint8_t type; // PacketType + + uint32_t size; + + SerializedObject object; + + DataPacket() { strcpy(magic, "PTAI"); } + + bool readHeader(SerializedObject &in); + bool readHeader(InputStream &in); + + bool read(SerializedObject &in); + bool read(InputStream &in); + + bool write(SerializedObject &out); + bool write(OutputStream &out); + + inline bool verifyMagic() { return magic[0] == 'V' && magic[1] == 'O' && magic[2] == 'X' && magic[3] == 'E' && magic[4] == 'L'; } +}; + + + +} + +#endif \ No newline at end of file diff --git a/libs/macos/include/pointcloud-1.0.0/DepthCamera.h b/libs/macos/include/pointcloud-1.0.0/DepthCamera.h new file mode 100644 index 0000000..9693552 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/DepthCamera.h @@ -0,0 +1,230 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DEPTHCAMERA_H +#define POINTCLOUD_DEPTHCAMERA_H + +#include +#include +#include "VideoMode.h" +#include +#include "FrameStream.h" +#include "Timer.h" +#include "Configuration.h" + +#define BULK_XFER_EXTRA_SIZE 255 +#define CALIB_SECT_LENS "lens" +#define CALIB_SECT_LENS_ID 0 +#define TSENSOR "tsensor" +#define TILLUM "tillum" + +namespace PointCloud +{ + class POINTCLOUD_EXPORT Streamer; + class POINTCLOUD_EXPORT Parameter; + class POINTCLOUD_EXPORT FrameGenerator; + class POINTCLOUD_EXPORT PointCloudFrameGenerator; + class POINTCLOUD_EXPORT RegisterProgrammer; + typedef Ptr StreamerPtr; + typedef Ptr ParameterPtr; + typedef Ptr RegisterProgrammerPtr; + typedef Ptr FrameGeneratorPtr; + typedef Ptr PointCloudFrameGeneratorPtr; + /** + * \ingroup CamSys + * + * \brief This is primary class which provides API for a depth camera. + * + * DepthCamera is an abstract class which needs to be derived and implemented + * for individual depth camera types. + */ + class POINTCLOUD_EXPORT DepthCamera + { + public: + enum FrameType + { + FRAME_RAW_FRAME_UNPROCESSED = 0, + FRAME_RAW_FRAME_PROCESSED = 1, + FRAME_DEPTH_FRAME = 2, + FRAME_XYZI_POINT_CLOUD_FRAME = 3, + FRAME_TYPE_COUNT = 4 // This is just used for number of callback types + }; + typedef Function CallbackType; + public: + DepthCamera(const String &name, const String &chipset, DevicePtr device); + virtual ~DepthCamera(); + virtual bool isInit() = 0; + virtual bool isInitialized() const; + inline bool isRunning() const { return _running; } + inline bool isPaused() const { return _isPaused; } + bool start(); + bool stop(); + void wait(); + bool reset(); + bool pause(); + bool resume(); + bool close(); + + virtual bool registerCallback(FrameType type, CallbackType f); + virtual bool clearAllCallbacks(); + virtual bool clearCallback(FrameType type); + + bool setFrameRate(const FrameRate &r); + bool getFrameRate(FrameRate &r) const; + bool setFrameSize(const FrameSize &s); + bool getFrameSize(FrameSize &s) const; + bool getMaximumFrameSize(FrameSize &s) const; + bool getMaximumFrameRate(FrameRate &frameRate, const FrameSize &forFrameSize) const; + bool getSupportedVideoModes(Vector &supportedVideoModes) const; + bool getMaximumVideoMode(VideoMode &videoMode) const; + + bool getROI(RegionOfInterest &roi); + bool setROI(const RegionOfInterest &roi); + bool allowedROI(String &message); + + bool getFieldOfView(float &fovHalfAngle) const; + + virtual bool saveFrameStream(const String &fileName); + virtual bool isSavingFrameStream(); + virtual bool closeFrameStream(); + + template + bool get(const String &name, T &value, bool refresh = false) const; + template + bool set(const String &name, const T &value); + + inline const String &name() const { return _name; } + inline const String &id() const { return _id; } + inline const String &chipset() const { return _chipset; } + + virtual bool getSerialNumber(String &serialNumber) const; + virtual bool setSerialNumber(const String &serialNumber); + + inline const DevicePtr &getDevice() const { return _device; } + template + bool getStreamParam(const String &name, T &value) const; + bool refreshParams(); + + // WARNING: Avoid using get() and set() on ParameterPtr, obtained via getParam() or getParameters(). It is not thread-safe. Instead use get() and set() on DepthCamera + const ParameterPtr getParam(const String &name) const; + inline const Map &getParameters() const { return _parameters; } + + bool getBytesPerPixel(uint &bpp) const; + bool setBytesPerPixel(const uint &bpp); + bool getFrameGeneratorConfig(FrameType type, SerializedObject &object); + // beforeFilterIndex = -1 => at the end, otherwise at location before the given filter index. + // Return value: + // >= 0 => add successfully with return value as filter ID. + // -1 => failed to add filter + virtual int addFilter(FilterPtr p, FrameType frameType, int beforeFilterID = -1); + virtual FilterPtr getFilter(int filterID, FrameType frameType) const; + virtual bool removeFilter(int filterID, FrameType frameType); + virtual bool removeAllFilters(FrameType frameType); + virtual void resetFilters(); + + inline const FilterSet &getUnprocessedRawFilterSet() { return _unprocessedFilters; } + inline const FilterSet &getProcessedRawFilterSet() { return _processedFilters; } + inline const FilterSet &getDepthFilterSet() { return _depthFilters; } + + // RegisterProgrammer is usually thread-safe to use outside directly + inline RegisterProgrammerPtr getProgrammer() { return _programmer; } + // Streamer may not be thread-safe + inline StreamerPtr getStreamer() { return _streamer; } + + inline bool reloadConfiguration() { return configFile.read(_name + ".conf"); } + inline const Map &getCameraProfileNames() { return configFile.getCameraProfileNames(); } + inline int getCurrentCameraProfileID() { return configFile.getCurrentProfileID(); } + + int addCameraProfile(const String &profileName, const int parentID); + bool setCameraProfile(const int id, bool softApply = false); + bool removeCameraProfile(const int id); + /* + inline bool saveCameraProfileToHardware(int &id, bool saveParents = false, bool setAsDefault = false, const String &namePrefix = "") { return configFile.saveCameraProfileToHardware(id, saveParents, setAsDefault, namePrefix); } + */ + protected: + bool _addParameters(const Vector ¶ms); + // Callback the registered function for 'type' if present and decide whether continue processing or not + virtual bool _callbackAndContinue(uint32_t &callBackTypesToBeCalled, FrameType type, const Frame &frame); + + bool _init(); + virtual bool _start() = 0; + virtual bool _stop() = 0; + + virtual bool _captureRawUnprocessedFrame(RawFramePtr &rawFrame) = 0; + virtual bool _processRawFrame(const RawFramePtr &rawFrameInput, RawFramePtr &rawFrameOutput) = 0; // here output raw frame will have processed data, like ToF data for ToF cameras + virtual bool _convertToDepthFrame(const RawFramePtr &rawFrame, DepthFramePtr &depthFrame) = 0; + virtual bool _convertToPointCloudFrame(const DepthFramePtr &depthFrame, PointCloudFramePtr &pointCloudFrame); + + virtual void _captureLoop(); // the main capture loop + void _captureThreadWrapper(); // this is non-virtual and simply calls _captureLoop + bool _running, _isPaused; // is capture running? + bool _writeToFrameStream(RawFramePtr &rawUnprocessed); + + // These protected getters and setters are not thread-safe. These are to be directly called only when nested calls are to be done from getter/setter to another. + // Otherwise use the public functions + template + bool _get(const String &name, T &value, bool refresh = false) const; + template + bool _set(const String &name, const T &value); + + virtual bool _setFrameRate(const FrameRate &r) = 0; + virtual bool _getFrameRate(FrameRate &r) const = 0; + virtual bool _setFrameSize(const FrameSize &s) = 0; + virtual bool _getFrameSize(FrameSize &s) const = 0; + virtual bool _getMaximumFrameSize(FrameSize &s) const = 0; + virtual bool _getMaximumFrameRate(FrameRate &frameRate, const FrameSize &forFrameSize) const = 0; + virtual bool _getSupportedVideoModes(Vector &supportedVideoModes) const = 0; + virtual bool _getMaximumVideoMode(VideoMode &videoMode) const = 0; + + virtual bool _getBytesPerPixel(uint &bpp) const = 0; + virtual bool _setBytesPerPixel(const uint &bpp) = 0; + + virtual bool _getROI(RegionOfInterest &roi) const = 0; + virtual bool _setROI(const RegionOfInterest &roi) = 0; + virtual bool _allowedROI(String &message) = 0; + virtual bool _getFieldOfView(float &fovHalfAngle) const = 0; + inline void _makeID() { _id = _name + "(" + _device->id() + ")"; } + virtual bool _reset() = 0; + virtual bool _onReset() = 0; + virtual bool _applyConfigParams(const ConfigSet *params); + virtual bool _saveCurrentProfileID(const int id) = 0; + virtual bool _getCurrentProfileID(int &id) = 0; + inline Map &_getCalibrationInformationStructure() { return configFile._calibrationInformation; } + public: + MainConfigurationFile configFile; // This corresponds to camera specific configuration file + private: + mutable Mutex _accessMutex; // This is locked by getters and setters which are public + mutable Mutex _frameStreamWriterMutex; + protected: + DevicePtr _device; + String _name, _id, _chipset; + + Map _parameters; + RegisterProgrammerPtr _programmer; + StreamerPtr _streamer; + + FrameGeneratorPtr _frameGenerators[3]; + PointCloudFrameGeneratorPtr _pointCloudFrameGenerator; + bool _parameterInit; + + RawFramePtr _rawFrame; + FrameBufferManager _rawFrameBuffers; + FrameBufferManager _depthFrameBuffers; + FrameBufferManager _pointCloudBuffers; + + FilterSet _unprocessedFilters, _processedFilters; + FilterSet _depthFilters; + FrameStreamWriterPtr _frameStreamWriter; + + CallbackType _callback[FRAME_TYPE_COUNT]; + + uint32_t _callBackTypesRegistered = 0; + ThreadPtr _captureThread = 0; + }; + typedef Ptr DepthCameraPtr; +} + +#endif // DEPTHCAMERA_H diff --git a/libs/macos/include/pointcloud-1.0.0/Device.h b/libs/macos/include/pointcloud-1.0.0/Device.h new file mode 100644 index 0000000..63eab76 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Device.h @@ -0,0 +1,127 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DEVICE_H +#define POINTCLOUD_DEVICE_H + +#include "Common.h" +#include + +namespace PointCloud +{ + +/** + * \addtogroup CamSys + * @{ + */ +class POINTCLOUD_EXPORT Device +{ +public: + enum Interface { + USB = 0, + LPT = 1, + SERIAL = 2, + I2C = 3 + }; +protected: + String _id; // in the format interface::device::serialnumber. "device" for USB devices is "vendorid:productid" + Interface _interfaceID; + String _deviceID; + String _serialNumber; + + String _serialIndex; + bool _showSerialIndex; + + String _description; + int _channelID; // Channel ID for multi-channel devices + + void _makeID() + { + std::ostringstream s; + s << _interfaceID << "::" << _deviceID << "::" << _serialNumber; + + if(_showSerialIndex) + s << ":" << _serialIndex; + + if(_channelID >= 0) + s << "::" << _channelID; + + _id = s.str(); + } + +public: + Device(Interface interfaceid, const String &deviceid, const String &serialnumber, int channelID = -1, const String &description = "", const String &serialIndex = "", bool showSerialIndex = false): _interfaceID(interfaceid), + _deviceID(deviceid), _serialNumber(serialnumber), _description(description), _channelID(channelID), _serialIndex(serialIndex), _showSerialIndex(showSerialIndex) + { + _makeID(); + } + + // Need to implement in all derived classes + virtual Vector> getDevices(const Vector &channels) const { return Vector>(); } + + inline const String &id() const { return _id; } + + inline Interface interfaceID() const { return _interfaceID; } + inline const String &deviceID() const { return _deviceID; } + inline const String &serialNumber() const { return _serialNumber; } + inline void setSerialNumber(const String &s) { _serialNumber = s; } + inline const String &serialIndex() const { return _serialIndex; } + inline void showSerialIndex() { _showSerialIndex = true; _makeID(); } + inline void dontShowSerialIndex() { _showSerialIndex = false; _makeID(); } + inline const int channelID() const { return _channelID; } + inline const String &description() const { return _description; } + virtual ~Device() {} +}; + +typedef Ptr DevicePtr; + +class POINTCLOUD_EXPORT USBDevice : public Device +{ + uint16_t _vendorID, _productID; +public: + USBDevice(uint16_t vendorid, uint16_t productid, const String &serialnumber, int channelID = -1, const String &description = "", const String &serialIndex = "", bool showSerialIndex = false): + Device(Device::USB, getHex(vendorid) + ":" + getHex(productid), serialnumber, channelID, description, serialIndex, showSerialIndex), _vendorID(vendorid), _productID(productid) {} +#ifdef ANDROID + USBDevice(uint16_t vendorid, uint16_t productid, const String &serialnumber, int usbfd,int channelID = -1, const String &description = "", const String &serialIndex = "", bool showSerialIndex = false): + Device(Device::USB, getHex(vendorid) + ":" + getHex(productid), serialnumber, channelID, description, serialIndex, showSerialIndex), _vendorID(vendorid), _productID(productid),usbFd(usbfd) {} +#endif + virtual Vector getDevices(const Vector &channels) const; + + inline uint16_t vendorID() const { return _vendorID; } + inline uint16_t productID() const { return _productID; } +#ifdef ANDROID + int usbFd; +#endif + + virtual ~USBDevice() {} +}; + +class POINTCLOUD_EXPORT DeviceScanner +{ +protected: + virtual Vector _scan() = 0; +public: + static Vector scan(); + + virtual ~DeviceScanner() {} +}; + +class POINTCLOUD_EXPORT USBDeviceScanner : public DeviceScanner +{ +protected: + virtual Vector _scan(); + friend class DeviceScanner; + + virtual ~USBDeviceScanner() {} +}; + +/** + * @} + */ + +} + +#endif // DEVICE_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/BilateralFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/BilateralFilter.h new file mode 100644 index 0000000..14692ac --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/BilateralFilter.h @@ -0,0 +1,52 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_BILATERAL_H +#define POINTCLOUD_BILATERAL_H + +#include "Filter.h" + +#include "DiscreteGaussian.h" + + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class BilateralFilter: public Filter +{ +protected: + DiscreteGaussian _discreteGuassian; + + FrameSize _size; + + virtual void _onSet(const FilterParameterPtr &f); + + template + bool _filter(const T *in, const T2 *ref, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + BilateralFilter(float sigma = 0.5); + virtual ~BilateralFilter() {} + + virtual void reset(); + + +}; + +/** + * @} + */ + +} + +#endif // POINTCLOUD_BILATERAL_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/DarkPixFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/DarkPixFilter.h new file mode 100644 index 0000000..0e47f22 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/DarkPixFilter.h @@ -0,0 +1,55 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DARKPIX_H +#define POINTCLOUD_DARKPIX_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT DarkPixFilter: public Filter +{ +protected: + float _aThrNear, _phThrNear; + float _aThrFar, _phThrFar; + float _ambThresh; + + Vector _current; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const T *in, T2 *amp, uint8_t *amb, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + DarkPixFilter(float aThrNear = 1, float phThrNear = 4095, float aThrFar = 20, float phThrFar = 2000, float ambThresh = 1); + + virtual void reset(); + + virtual ~DarkPixFilter() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_DARKPIX_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/DenoiseFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/DenoiseFilter.h new file mode 100644 index 0000000..5290ae0 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/DenoiseFilter.h @@ -0,0 +1,64 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DENOISE_H +#define POINTCLOUD_DENOISE_H + +#include "Filter.h" + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT DenoiseFilter: public Filter +{ +protected: + uint _order; + float _threshold; + + std::deque> _ampHistory; + std::deque> _phaseHistory; + std::deque> _ambHistory; + std::deque> _flagsHistory; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const FramePtr &in_p, FramePtr &out_p); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + DenoiseFilter(uint order = 3, float threshold = 30/*10000*/); + + virtual void reset(); + + virtual ~DenoiseFilter() {} + +// liudao add in 2017.06.13 +public: + Vector m_frameIn; + Vector m_frameOut; + +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_DENOISE_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/DiscreteGaussian.h b/libs/macos/include/pointcloud-1.0.0/Filter/DiscreteGaussian.h new file mode 100644 index 0000000..0ab695c --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/DiscreteGaussian.h @@ -0,0 +1,71 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DISCRETE_GUASSIAN_H +#define POINTCLOUD_DISCRETE_GUASSIAN_H + +#include "Common.h" + +#define _MATH_DEFINES +#include + + +namespace PointCloud +{ + +class POINTCLOUD_EXPORT DiscreteGaussian +{ + float _sigma, _squaredSigma; + + Vector _values; + + inline void _computeValues(); + +public: + DiscreteGaussian(float s) { setStandardDeviation(s); } + + inline void setStandardDeviation(float s) + { + _sigma = s; + _squaredSigma = _sigma*_sigma; + _computeValues(); + } + + inline float getStandardDeviation() const { return _sigma; } + inline float getSquaredStandardDeviation() const { return _squaredSigma; } + + inline float valueAt(int x) + { + int y = (x < 0)?-x:x; + + if(y >= _values.size()) + return 0.0f; + else + return _values[y]; + } +}; + +inline void DiscreteGaussian::_computeValues() +{ + int limit = sqrt(20)*_sigma + 1; // This would correspond to exp(-10) + + _values.resize(limit); + + if(!floatEquals(_sigma, 0)) + { + float d = _sigma*sqrt(2*M_PI); + + for(auto i = 0; i < limit; i++) + _values[i] = exp(-i*i/2.0f/_squaredSigma)/d; + } + else + _values[0] = 1; +} + + +} + +#endif diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/Filter.h b/libs/macos/include/pointcloud-1.0.0/Filter/Filter.h new file mode 100644 index 0000000..df4a37e --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/Filter.h @@ -0,0 +1,199 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FILTER_H +#define POINTCLOUD_FILTER_H + + +#include +//#include +#include +#include + +#include + +#include "PointCloudExports.h" + +namespace PointCloud +{ + +class DepthCamera; + +typedef Ptr DepthCameraPtr; + +/** + * \defgroup Flt Filter related classes + * @{ + */ + +class POINTCLOUD_EXPORT Filter +{ +protected: + String _name, _nameScope, _description; + String _id; + + inline void _makeID() + { + if(_nameScope.size()) + _id = _nameScope + "::" + _name; + else + _id = _name; + } + + mutable Mutex _accessMutex; + + DepthCameraPtr _depthCamera; + + Map _parameters; + + virtual bool _addParameters(const Vector ¶ms); + + virtual bool _prepareOutput(const FramePtr &in, FramePtr &out); + + // On setting of a parameter this is called + virtual void _onSet(const FilterParameterPtr &f) = 0; + + virtual bool _filter(const FramePtr &in, FramePtr &out) = 0; + + template + bool _get(const String &name, T &value); + + template + bool _set(const String &name, const T &value); + +public: + Filter(const String &name, const String &description = "", const String &nameScope = ""): _name(name), _nameScope(nameScope), _description(description) + { + _makeID(); + } + + inline void setDepthCamera(const DepthCameraPtr &d) + { + _depthCamera = d; + } + + inline const Map ¶meters() { return _parameters; } + + inline const String &name() { return _id; } + inline const String &description() { return _description; } + + inline void setNameScope(const String &scope) { _nameScope = scope; _makeID(); } + + inline bool filter(const FramePtr &in, FramePtr &out); + + virtual void reset() = 0; + + inline FilterParameterConstPtr getParam(const String &name) const; + + template + bool get(const String &name, T &value); + + template + bool set(const String &name, const T &value); + + + virtual ~Filter() {} +}; + +inline bool Filter::filter(const FramePtr &in, FramePtr &out) +{ + Lock _(_accessMutex); + return _filter(in, out); +} + + +FilterParameterConstPtr Filter::getParam(const String &name) const +{ + Lock _(_accessMutex); + + auto p = _parameters.find(name); + + if(p != _parameters.end()) + return std::const_pointer_cast(p->second); + else + return nullptr; +} + + +template +bool Filter::get(const String &name, T &value) +{ + Lock _(_accessMutex); + return _get(name, value); +} + +template +bool Filter::_get(const String &name, T &value) +{ + auto p = _parameters.find(name); + + if(p != _parameters.end()) + { + FilterParameterTemplate *f = dynamic_cast *>(p->second.get()); + + if(!f) + { + logger(LOG_ERROR) << "Filter: Invalid type '" << typeid(value).name() << "' to get parameter '" << name << "'" << std::endl; + return false; + } + + return f->get(value); + } + else + { + logger(LOG_ERROR) << "Filter: Unknown parameter name '" << name << "'" << std::endl; + return false; + } +} + +template +bool Filter::set(const String &name, const T &value) +{ + Lock _(_accessMutex); + return _set(name, value); +} + +template +bool Filter::_set(const String &name, const T &value) +{ + auto p = _parameters.find(name); + + if(p != _parameters.end()) + { + FilterParameterTemplate *f = dynamic_cast *>(p->second.get()); + + if(!f) + { + logger(LOG_ERROR) << "Filter: Invalid type '" << typeid(value).name() << "' to get parameter '" << name << "'" << std::endl; + return false; + } + + if(f->set(value)) + { + _onSet(p->second); + return true; + } + else + return false; + } + else + { + logger(LOG_ERROR) << "Filter: Unknown parameter name '" << name << "'" << std::endl; + return false; + } +} + +typedef Ptr FilterPtr; + +/** + * @} + */ + + +} + + +#endif //POINTCLOUD_FILTER_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/FilterFactory.h b/libs/macos/include/pointcloud-1.0.0/Filter/FilterFactory.h new file mode 100644 index 0000000..c7e8eb4 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/FilterFactory.h @@ -0,0 +1,78 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FILTER_FACTORY_H +#define POINTCLOUD_FILTER_FACTORY_H + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class FilterDescription +{ + typedef Function _CreateFilter; +protected: + _CreateFilter _createFilter; +public: + String name; + uint frameTypes; // supported frame types (see #DepthCamera::FrameType) + + FilterDescription() {} + +#ifndef SWIG + FilterDescription(const String &n, uint f, _CreateFilter c): name(n), frameTypes(f), _createFilter(c) {} +#endif + + inline bool supports(DepthCamera::FrameType type) + { + return frameTypes & (1 << type); + } + + friend class FilterFactory; +}; + +class POINTCLOUD_EXPORT FilterFactory +{ + +protected: + Map _supportedFilters; + bool _addSupportedFilters(const Vector &f); + + String _name; + +public: + FilterFactory(const String &name): _name(name) {} + + inline const String &name() const { return _name; } + + inline const Map &getSupportedFilters() const { return _supportedFilters; } + + virtual FilterPtr createFilter(const String &name, DepthCamera::FrameType type); +}; + +typedef Ptr FilterFactoryPtr; + +#ifndef SWIG +extern "C" void getFilterFactory(FilterFactoryPtr &filterFactory); +#endif + +typedef void (*GetFilterFactory)(FilterFactoryPtr &filterFactory); // Function type to return DepthCameraFactory + +/** + * @} + */ + +} + + +#endif diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/FilterParameter.h b/libs/macos/include/pointcloud-1.0.0/Filter/FilterParameter.h new file mode 100644 index 0000000..4a56471 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/FilterParameter.h @@ -0,0 +1,199 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FILTER_PARAMETER_H +#define POINTCLOUD_FILTER_PARAMETER_H + +#include "Common.h" + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class FilterParameter +{ +protected: + String _name, _displayName, _description; + +public: + FilterParameter(const String &name, const String &displayName, const String &description): + _name(name), _displayName(displayName), _description(description) {} + + inline const String &name() const { return _name; } + inline const String &displayName() const { return _displayName; } + inline const String &description() const { return _description; } + + virtual ~FilterParameter() {} +}; + +typedef Ptr FilterParameterPtr; +typedef Ptr FilterParameterConstPtr; + +template +class FilterParameterTemplate: public FilterParameter +{ +protected: + T _value; + +public: + FilterParameterTemplate(const String &name, const String &displayName, const String &description, const T &defaultValue): + FilterParameter(name, displayName, description), _value(defaultValue) {} + + static Ptr> typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast>(other); + } + + virtual bool get(T &v) const { v = _value; return true; } + virtual bool set(const T &v) + { + if(validate(v)) + { + _value = v; + return true; + } + else + return false; + } + + virtual bool validate(const T &v) const = 0; + + virtual ~FilterParameterTemplate() {} +}; + +typedef FilterParameterTemplate BoolFilterParameterTemplate; +typedef FilterParameterTemplate IntegerFilterParameterTemplate; +typedef FilterParameterTemplate UnsignedIntegerFilterParameterTemplate; +typedef FilterParameterTemplate FloatFilterParameterTemplate; + +#ifdef SWIG +%template(BoolFilterParameterTemplate) FilterParameterTemplate; +%template(IntegerFilterParameterTemplate) FilterParameterTemplate; +%template(UnsignedIntegerFilterParameterTemplate) FilterParameterTemplate; +%template(FloatFilterParameterTemplate) FilterParameterTemplate; +#endif + + +template +class FilterParameterRangeTemplate: public FilterParameterTemplate +{ +protected: + T _lowerLimit, _upperLimit; + String _unit; +public: + FilterParameterRangeTemplate(const String &name, const String &displayName, const String &description, const T &defaultValue, + const String &unit, + const T &lowerLimit, const T &upperLimit): + FilterParameterTemplate(name, displayName, description, defaultValue), + _unit(unit), + _lowerLimit(lowerLimit), _upperLimit(upperLimit) {} + + static Ptr> typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast>(other); + } + + inline const T &lowerLimit() const { return _lowerLimit; } + inline const T &upperLimit() const { return _upperLimit; } + + inline const String &unit() const { return _unit; } + + virtual bool validate(const T &v) const + { + return (v >= _lowerLimit && v <= _upperLimit); + } + + virtual ~FilterParameterRangeTemplate() {} +}; + +typedef FilterParameterRangeTemplate UnsignedFilterParameter; +typedef FilterParameterRangeTemplate SignedFilterParameter; +typedef FilterParameterRangeTemplate FloatFilterParameter; + +#ifdef SWIG +%template(SignedFilterParameter) FilterParameterRangeTemplate; +%template(UnsignedFilterParameter) FilterParameterRangeTemplate; +%template(FloatFilterParameter) FilterParameterRangeTemplate; +#endif + + + +template +class FilterParameterEnumTemplate: public FilterParameterTemplate +{ +protected: + Vector _values; + Vector _valueMeaning, _valueDescription; + +public: + FilterParameterEnumTemplate(const String &name, const String &displayName, const String &description, const T &defaultValue, + const Vector &values, const Vector &valueMeaning, const Vector &valueDescription): + FilterParameterTemplate(name, displayName, description, defaultValue), + _values(values), _valueMeaning(valueMeaning), _valueDescription(valueDescription) {} + + static Ptr> typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast>(other); + } + + inline const Vector &valueMeaning() const { return _valueMeaning; } + inline const Vector &valueDescription() const { return _valueDescription; } + inline const Vector &values() const { return _values; } + + virtual bool validate(const T &v) const + { + for(auto t: _values) + { + if(t == v) + return true; + } + return false; + } + + virtual ~FilterParameterEnumTemplate() {} +}; + +typedef FilterParameterEnumTemplate EnumFilterParameter; + +typedef FilterParameterEnumTemplate BoolEnumFilterParameterTemplate; + +#ifdef SWIG +%template(BoolEnumFilterParameterTemplate) FilterParameterEnumTemplate; +%template(EnumFilterParameter) FilterParameterEnumTemplate; +#endif + + +class BoolFilterParameter: public FilterParameterEnumTemplate +{ +public: + BoolFilterParameter(const String &name, const String &displayName, const String &description, const bool &defaultValue, + const Vector &valueMeaning, const Vector &valueDescription): + FilterParameterEnumTemplate(name, displayName, description, defaultValue, {false, true}, + valueMeaning, valueDescription) {} + + + static Ptr typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast(other); + } + + + virtual ~BoolFilterParameter() {} +}; + +typedef BoolFilterParameter StrobeBoolFilterParameter; // Typedef StrobeBool to be same Bool parameter + +/** + * @} + */ + +} + +#endif // POINTCLOUD_FILTER_PARAMETER_H \ No newline at end of file diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/FilterSet.h b/libs/macos/include/pointcloud-1.0.0/Filter/FilterSet.h new file mode 100644 index 0000000..410bcee --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/FilterSet.h @@ -0,0 +1,279 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAME_FILTER_SET_H +#define POINTCLOUD_FRAME_FILTER_SET_H + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +template +class FilterSet; + +template +class FilterSetIterator +{ +public: + int i; + const FilterSet &s; + int index; + + FilterSetIterator(const FilterSet &s, int i = 0); + inline FilterSetIterator &operator++(int); + inline FilterSetIterator &operator++(); + inline const FilterPtr operator *(); + inline bool operator !=(const FilterSetIterator &other) const; + inline bool operator ==(const FilterSetIterator &other) const; +}; + +template +class FilterSet +{ +protected: + Vector _indices; + int _filterCounter; + Map _filters; + + mutable Mutex _accessMutex; + + FrameBufferManager &_frameBufferManager; + +public: + class FrameSequence: public List> + { + public: + ~FrameSequence() + { + while(this->size()) + this->pop_front(); + } + }; + + FilterSet(FrameBufferManager &m): _frameBufferManager(m), _filterCounter(0) { _indices.reserve(10); } + + // position = -1 => at the end, otherwise at zero-indexed 'position' + int addFilter(FilterPtr p, int beforeFilterIndex = -1); + FilterPtr getFilter(int index) const; + bool removeFilter(int index); + bool removeAllFilters(); + + inline SizeType size() const { return _indices.size(); } + + // Populate one entry in 'seq' before calling this function. That entry will be used + // as input to the first filter and then onwards till the last filter. Each filter will + // append one entry which contains the filter frame + bool applyFilter(FrameSequence &seq); + + void reset(); + + FilterSetIterator begin() const + { + return FilterSetIterator(*this, 0); + } + + FilterSetIterator end() const + { + return FilterSetIterator(*this, _indices.size()); + } + + friend class FilterSetIterator; +}; + +template +int FilterSet::addFilter(FilterPtr p, int beforeFilterIndex) +{ + Lock _(_accessMutex); + + if( beforeFilterIndex == -1) + _indices.push_back(_filterCounter); + else + { + auto found = -1; + for(auto i = 0; i < _indices.size(); i++) + if(_indices[i] == beforeFilterIndex) + found = i; + + if(found < 0) + return -1; // -1 => invalid filter index + + _indices.insert(_indices.begin() + found, _filterCounter); + } + + _filters[_filterCounter] = p; + + _frameBufferManager.setMinimumBufferCount(_frameBufferManager.getMinimumBufferCount() + 1); + + int i = _filterCounter; + + _filterCounter++; + + return i; +} + +template +FilterPtr FilterSet::getFilter(int index) const +{ + Lock _(_accessMutex); + + auto x = _filters.find(index); + + if(x != _filters.end()) + return x->second; + else + return nullptr; +} + + +template +bool FilterSet::removeFilter(int index) +{ + Lock _(_accessMutex); + + auto x = _filters.find(index); + + if(x != _filters.end()) + { + for(auto i = 0; i < _indices.size(); i++) + { + if(_indices[i] == index) + { + _indices.erase(_indices.begin() + i); + break; + } + } + _filters.erase(x); + _frameBufferManager.setMinimumBufferCount(_frameBufferManager.getMinimumBufferCount() - 1); + + return true; + } + + return false; +} + +template +bool FilterSet::removeAllFilters() +{ + Lock _(_accessMutex); + + _frameBufferManager.setMinimumBufferCount(_frameBufferManager.getMinimumBufferCount() - _filters.size()); + _filters.clear(); + _indices.clear(); + + return true; +} + +template +bool FilterSet::applyFilter(FrameSequence &seq) +{ + Lock _(_accessMutex); + + if(seq.size() < 1) + { + logger(LOG_ERROR) << "Require atleast one frame in the sequence, to apply filters" << std::endl; + return false; + } + + for(auto f: *this) + { + auto g = _frameBufferManager.get(); + + FramePtr p = std::dynamic_pointer_cast(*g); + + if(!f->filter(std::dynamic_pointer_cast(**seq.begin()), p)) + { + logger(LOG_ERROR) << "FilterSet: Could not apply filter '" << f->name() << "'" << std::endl; + return false; + } + + *g = std::dynamic_pointer_cast(p); + + if(!*g) + { + logger(LOG_ERROR) << "FilterSet: Got an invalid frame from filter '" << f->name() << "'" << std::endl; + return false; + } + + seq.push_front(g); + } + return true; +} + +template +void FilterSet::reset() +{ + for(auto f: *this) + f->reset(); +} + +template +FilterSetIterator::FilterSetIterator(const FilterSet &s, int i): s(s), i(i) +{ + if(i < s._indices.size()) + index = s._indices[i]; +} + +template +inline FilterSetIterator &FilterSetIterator::operator++(int) +{ + i++; + + if(i < s._indices.size()) + index = s._indices[i]; + + return *this; +} + +template +inline FilterSetIterator &FilterSetIterator::operator++() +{ + i++; + + if(i < s._indices.size()) + index = s._indices[i]; + + return *this; +} + +template +inline const FilterPtr FilterSetIterator::operator *() +{ + if(i < s._indices.size()) + { + return s._filters.at(index); + } + else + return nullptr; +} + +template +inline bool FilterSetIterator::operator !=(const FilterSetIterator &other) const +{ + return !operator==(other); +} + +template +inline bool FilterSetIterator::operator ==(const FilterSetIterator &other) const +{ + return (&s == &other.s) && (i == other.i); +} + + +/** + * @} + */ + + +} + +#endif //POINTCLOUD_FRAME_FILTER_SET_H \ No newline at end of file diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/FlyingPixFilter2.h b/libs/macos/include/pointcloud-1.0.0/Filter/FlyingPixFilter2.h new file mode 100644 index 0000000..7080920 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/FlyingPixFilter2.h @@ -0,0 +1,53 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2017.6.1 by liudao + * method: remove jump point + */ + +#ifndef POINTCLOUD_FLYINGPIX2_H +#define POINTCLOUD_FLYINGPIX2_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT FlyingPixFilter2: public Filter +{ +protected: + uint _greaterNum; // 邻域内大于给定值的元素个数 + uint _phaseDiffTh; // phase差值阈值 + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const FramePtr &in_p, FramePtr &out_p); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + FlyingPixFilter2(uint nPhasediffth=10, uint nGreaterNum=4); + + virtual void reset(); + + virtual ~FlyingPixFilter2() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_DARKPIX_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/FlypixFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/FlypixFilter.h new file mode 100644 index 0000000..473d573 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/FlypixFilter.h @@ -0,0 +1,50 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) PointCloud.AI Inc. + */ + +#ifndef POINTCLOUD_FLYPIX_H +#define POINTCLOUD_FLYPIX_H + +#include "Filter.h" + +#define _MATH_DEFINES +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT FlypixFilter: public Filter +{ +protected: + float _thr; + + FrameSize _size; + + virtual void _onSet(const FilterParameterPtr &f); + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + FlypixFilter(float thr = 500); + virtual ~FlypixFilter() {} + + virtual void reset(); +}; + + +/** + * @} + */ + +} +#endif // POINTCLOUD_FLYPIX_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/HDRFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/HDRFilter.h new file mode 100644 index 0000000..8c5bbf8 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/HDRFilter.h @@ -0,0 +1,65 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_HDR_H +#define POINTCLOUD_HDR_H + +#include "Filter.h" + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT HDRFilter: public Filter +{ +protected: + uint _order; + + std::deque> _ampHistory; + std::deque> _phaseHistory; + std::deque> _ambHistory; + std::deque> _flagsHistory; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const FramePtr &in_p, FramePtr &out_p); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + HDRFilter(uint order = 2); + char *buffer; + char *processedbuffer; + + int newId; + int getId() + { + return newId++; + } + + virtual void reset(); + + virtual ~HDRFilter() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_HDR_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/IIRFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/IIRFilter.h new file mode 100644 index 0000000..4ff0f5b --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/IIRFilter.h @@ -0,0 +1,49 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_IIR_H +#define POINTCLOUD_IIR_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT IIRFilter: public Filter +{ +protected: + float _gain; + Vector _current; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + IIRFilter(float gain = 0.5); + + virtual void reset(); + + virtual ~IIRFilter() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_IIR_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/MedianFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/MedianFilter.h new file mode 100644 index 0000000..306c293 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/MedianFilter.h @@ -0,0 +1,51 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_MEDIAN_FILTER_H +#define POINTCLOUD_MEDIAN_FILTER_H + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class MedianFilter: public Filter +{ +protected: + float _stability, _deadband, _deadbandStep; + uint _halfKernelSize; + + Vector _current, _hist; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + virtual void _onSet(const FilterParameterPtr &f); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + MedianFilter(float stability = 0.1, float deadband = 0.05, float deadbandStep = 0.01, uint halfKernelSize = 1); + virtual ~MedianFilter() {} + + virtual void reset(); +}; + +/** + * @} + */ + + +} +#endif // POINTCLOUD_MEDIAN_FILTER_H \ No newline at end of file diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/NonlinearFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/NonlinearFilter.h new file mode 100644 index 0000000..432af15 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/NonlinearFilter.h @@ -0,0 +1,51 @@ +// +// NonlinearFilter.hpp +// +// + +#ifndef NonlinearFilter_hpp +#define NonlinearFilter_hpp +#include "Filter.h" +#include +#define LIGHT_SPEED 299792458.0 +namespace PointCloud +{ + + /** + * \addtogroup Flt + * @{ + */ + + class POINTCLOUD_EXPORT NonlinearFilter : public Filter + { + protected: + float _modFreq; + Vector _current; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + + public: + NonlinearFilter(float frequce = 36); + + virtual void reset(); + + virtual ~NonlinearFilter() {} + float scaleFactor; + static float phase2distance[]; + static int *nonlinearPhase; + static int mapArraySize; + }; + /** + * @} + */ + +} + +#endif /* NonlinearFilter_hpp */ diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/SmoothFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/SmoothFilter.h new file mode 100644 index 0000000..45c58da --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/SmoothFilter.h @@ -0,0 +1,51 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_SMOOTH_H +#define POINTCLOUD_SMOOTH_H + +#include "Filter.h" +#include "DiscreteGaussian.h" + +#define _MATH_DEFINES +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class SmoothFilter: public Filter +{ +protected: + DiscreteGaussian _discreteGaussian; + + FrameSize _size; + + virtual void _onSet(const FilterParameterPtr &f); + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + SmoothFilter(float sigma = 0.5); + virtual ~SmoothFilter() {} + + virtual void reset(); +}; + + +/** + * @} + */ + +} +#endif // POINTCLOUD_SMOOTH_H diff --git a/libs/macos/include/pointcloud-1.0.0/Filter/TemporalMedianFilter.h b/libs/macos/include/pointcloud-1.0.0/Filter/TemporalMedianFilter.h new file mode 100644 index 0000000..09d042b --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Filter/TemporalMedianFilter.h @@ -0,0 +1,52 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_TEMPORAL_MEDIAN_FILTER_H +#define POINTCLOUD_TEMPORAL_MEDIAN_FILTER_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ +/** + * \addtogroup Flt + * @{ + */ +class TemporalMedianFilter: public Filter +{ +protected: + float _deadband; + uint _order; + + FrameSize _size; + List> _history; + Vector _current; + + virtual void _onSet(const FilterParameterPtr &f); + + template + void _getMedian(IndexType offset, T &value); + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + TemporalMedianFilter(uint order = 3, float deadband = 0.05); + virtual ~TemporalMedianFilter() {} + + virtual void reset(); +}; + +/** + * @} + */ + +} +#endif // POINTCLOUD_TEMPORAL_MEDIAN_FILTER_H diff --git a/libs/macos/include/pointcloud-1.0.0/Frame.h b/libs/macos/include/pointcloud-1.0.0/Frame.h new file mode 100644 index 0000000..0d15041 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Frame.h @@ -0,0 +1,784 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAME_H +#define POINTCLOUD_FRAME_H + +#include +#include +#include "VideoMode.h" +#include "SerializedObject.h" + +#include + + +namespace PointCloud +{ + +/** + * \defgroup Frm Frame related classes + * @{ + */ + +class POINTCLOUD_EXPORT Frame +{ +public: + TimeStampType timestamp = 0; // Unix timestamp in micro-seconds + int id = -1; + + inline operator String() + { + std::ostringstream s; + s << id << "@" << timestamp; + return s.str(); + } + + virtual Ptr copy() const = 0; + virtual Ptr copyTo(Ptr &other) const = 0; + virtual Ptr newFrame() const = 0; + + virtual bool isSameType(const Frame &other) const = 0; + virtual bool isSameSize(const Frame &other) const = 0; + + virtual bool serialize(SerializedObject &object) const = 0; + + virtual bool deserialize(SerializedObject &object) = 0; + + virtual ~Frame() {} +}; + +typedef Ptr FramePtr; + +class POINTCLOUD_EXPORT DepthFrame: public Frame +{ +public: + Vector depth; // depth frame row-wise. Unit: meters + Vector amplitude; // amplitude of each depth pixel normalized to value between 0 and 1 + FrameSize size; + + virtual Ptr copy() const + { + Ptr f(new DepthFrame()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new DepthFrame()); + + DepthFrame *d = dynamic_cast(other.get()); + + d->id = id; + d->timestamp = timestamp; + d->depth = depth; + d->amplitude = amplitude; + d->size = size; + return other; + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + depth.size()*sizeof(float)*2 + sizeof(size_t)*2; + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + object.put((const char *)&size.width, sizeof(size.width)); + object.put((const char *)&size.height, sizeof(size.height)); + + object.put((const char *)depth.data(), sizeof(float)*depth.size()); + object.put((const char *)amplitude.data(), sizeof(float)*amplitude.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + if(!object.get((char *)&id, sizeof(id)) || + !object.get((char *)×tamp, sizeof(timestamp)) || + !object.get((char *)&size.width, sizeof(size.width)) || + !object.get((char *)&size.height, sizeof(size.height))) + return false; + + depth.resize(size.width*size.height); + amplitude.resize(size.width*size.height); + + if(!object.get((char *)depth.data(), sizeof(float)*depth.size()) || + !object.get((char *)amplitude.data(), sizeof(float)*amplitude.size())) + return false; + + return true; + } + + virtual bool isSameType(const Frame &other) const + { + const DepthFrame *f = dynamic_cast(&other); + return f; + } + + virtual bool isSameSize(const Frame &other) const + { + const DepthFrame *f = dynamic_cast(&other); + return (f && size == f->size); + } + + virtual Ptr newFrame() const + { + DepthFrame *d = new DepthFrame(); + d->depth.resize(depth.size()); + d->amplitude.resize(amplitude.size()); + d->size = size; + return FramePtr(d); + } + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~DepthFrame() {} +}; + +typedef Ptr DepthFramePtr; + +class POINTCLOUD_EXPORT RawFrame: public Frame +{ +public: + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~RawFrame() {} +}; + +typedef Ptr RawFramePtr; + +enum ToFFrameType { + ToF_PHASE_AMPLITUDE, + ToF_I_Q, + ToF_QUAD +}; + +class POINTCLOUD_EXPORT ToFRawFrame : public RawFrame +{ +public: + virtual const uint8_t *phase() const = 0; + virtual uint8_t *phase() = 0; + virtual SizeType phaseWordWidth() const = 0; // in bytes + + virtual const uint8_t *amplitude() const = 0; + virtual uint8_t *amplitude() = 0; + virtual SizeType amplitudeWordWidth() const = 0; // in bytes + + virtual const uint8_t *flags() const = 0; + virtual uint8_t *flags() = 0; + virtual SizeType flagsWordWidth() const = 0; // in bytes + + virtual const uint8_t *ambient() const = 0; + virtual uint8_t *ambient() = 0; + virtual SizeType ambientWordWidth() const = 0; // in bytes + + virtual const uint16_t *histogram() const = 0; + virtual uint16_t *histogram() = 0; + virtual SizeType histogramSize() const = 0; // number of elements in the histogram + + FrameSize size; + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~ToFRawFrame() {} +}; + +typedef Ptr ToFRawFramePtr; + +template +class POINTCLOUD_EXPORT ToFRawFrameTemplate : public ToFRawFrame +{ +public: + typedef PhaseByteType AmplitudeByteType; + typedef AmbientByteType FlagsByteType; + + Vector _phase; + Vector _amplitude; + + Vector _ambient; + Vector _flags; + + Vector _histogram; + + virtual const uint8_t *ambient() const + { + return (const uint8_t *)_ambient.data(); + } + + virtual uint8_t *ambient() + { + return (uint8_t *)_ambient.data(); + } + + virtual SizeType ambientWordWidth() const + { + return sizeof(AmbientByteType); + } + + virtual const uint8_t *amplitude() const + { + return (const uint8_t *)_amplitude.data(); + } + + virtual uint8_t *amplitude() + { + return (uint8_t *)_amplitude.data(); + } + + virtual SizeType amplitudeWordWidth() const + { + return sizeof(AmplitudeByteType); + } + + virtual const uint8_t *phase() const + { + return (const uint8_t *)_phase.data(); + } + + virtual uint8_t *phase() + { + return (uint8_t *)_phase.data(); + } + + virtual SizeType phaseWordWidth() const + { + return sizeof(PhaseByteType); + } + + virtual const uint8_t *flags() const + { + return (const uint8_t *)_flags.data(); + } + + virtual uint8_t *flags() + { + return (uint8_t *)_flags.data(); + } + + virtual SizeType flagsWordWidth() const + { + return sizeof(FlagsByteType); + } + + virtual const uint16_t *histogram() const + { + return _histogram.data(); + } + + virtual uint16_t *histogram() + { + return _histogram.data(); + } + + virtual SizeType histogramSize() const + { + return _histogram.size(); + } + + virtual Ptr copy() const + { + Ptr f(new ToFRawFrameTemplate()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new ToFRawFrameTemplate()); + + auto *t = dynamic_cast *>(other.get()); + + t->id = id; + t->timestamp = timestamp; + t->_phase = _phase; + t->_amplitude = _amplitude; + t->_ambient = _ambient; + t->_flags = _flags; + t->_histogram = _histogram; + t->size = size; + return other; + } + + virtual Ptr newFrame() const + { + ToFRawFrameTemplate *t = new ToFRawFrameTemplate(); + t->_phase.resize(_phase.size()); + t->_amplitude.resize(_amplitude.size()); + t->_ambient.resize(_ambient.size()); + t->_flags.resize(_flags.size()); + t->_histogram.resize(_histogram.size()); + t->size = size; + return FramePtr(t); + } + + virtual bool isSameType(const Frame &other) const + { + const ToFRawFrameTemplate *f = dynamic_cast *>(&other); + return f; + } + + static Ptr> typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast>(ptr); + } + + virtual bool isSameSize(const Frame &other) const + { + const ToFRawFrameTemplate *f = dynamic_cast *>(&other); + return (f && size == f->size); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + + _phase.size()*sizeof(PhaseByteType) + + _amplitude.size()*sizeof(AmplitudeByteType) + + _ambient.size()*sizeof(AmbientByteType) + + _flags.size()*sizeof(FlagsByteType) + + _histogram.size()*sizeof(uint16_t) + + sizeof(size_t)*2; + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + size_t histogramSize = _histogram.size(); + object.put((const char *)&size.width, sizeof(size.width)); + object.put((const char *)&size.height, sizeof(size.height)); + object.put((const char *)&histogramSize, sizeof(histogramSize)); + + object.put((const char *)_phase.data(), sizeof(PhaseByteType)*_phase.size()); + object.put((const char *)_amplitude.data(), sizeof(AmplitudeByteType)*_amplitude.size()); + object.put((const char *)_ambient.data(), sizeof(AmbientByteType)*_ambient.size()); + object.put((const char *)_flags.data(), sizeof(FlagsByteType)*_flags.size()); + + if(histogramSize) + object.put((const char *)_histogram.data(), sizeof(uint16_t)*_histogram.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + object.get((char *)&id, sizeof(id)); + object.get((char *)×tamp, sizeof(timestamp)); + + size_t histogramSize; + object.get((char *)&size.width, sizeof(size.width)); + object.get((char *)&size.height, sizeof(size.height)); + object.get((char *)&histogramSize, sizeof(histogramSize)); + + unsigned int frameSize = size.width*size.height; + _phase.resize(frameSize); + _amplitude.resize(frameSize); + _ambient.resize(frameSize); + _flags.resize(frameSize); + + object.get((char *)_phase.data(), sizeof(PhaseByteType)*_phase.size()); + object.get((char *)_amplitude.data(), sizeof(AmplitudeByteType)*_amplitude.size()); + object.get((char *)_ambient.data(), sizeof(AmbientByteType)*_ambient.size()); + object.get((char *)_flags.data(), sizeof(FlagsByteType)*_flags.size()); + + if(histogramSize) + { + _histogram.resize(histogramSize); + object.get((char *)_histogram.data(), sizeof(uint16_t)*_histogram.size()); + } + else + _histogram.clear(); + + return true; + } + + virtual ~ToFRawFrameTemplate() {} +}; + + +//typedef ToFRawFrameTemplate Uint1608ToFRawFrameTemplate; + +class POINTCLOUD_EXPORT ToFRawIQFrame: public RawFrame +{ +public: + virtual const uint8_t *i() const = 0; + virtual uint8_t *i() = 0; + virtual const uint8_t *q() const = 0; + virtual uint8_t *q() = 0; + virtual SizeType wordWidth() const = 0; // in bytes + + FrameSize size; + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~ToFRawIQFrame() {} +}; + +typedef Ptr ToFRawIQFramePtr; + +template +class POINTCLOUD_EXPORT ToFRawIQFrameTemplate : public ToFRawIQFrame +{ +public: + Vector _i; + Vector _q; + + virtual const uint8_t *i() const + { + return (const uint8_t *)_i.data(); + } + + virtual uint8_t *i() + { + return (uint8_t *)_i.data(); + } + + virtual const uint8_t *q() const + { + return (const uint8_t *)_q.data(); + } + + virtual uint8_t *q() + { + return (uint8_t *)_q.data(); + } + + virtual SizeType wordWidth() const + { + return sizeof(ByteType); + } + + virtual Ptr copy() const + { + Ptr f(new ToFRawIQFrameTemplate()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if (!other || !isSameType(*other)) + other = Ptr(new ToFRawIQFrameTemplate()); + + auto *t = dynamic_cast *>(other.get()); + t->id = id; + t->timestamp = timestamp; + t->_i = _i; + t->_q = _q; + t->size = size; + return other; + } + + virtual Ptr newFrame() const + { + ToFRawIQFrameTemplate *t = new ToFRawIQFrameTemplate(); + t->_i.resize(_i.size()); + t->_q.resize(_q.size()); + t->size = size; + return FramePtr(t); + } + + virtual bool isSameType(const Frame &other) const + { + const ToFRawIQFrameTemplate *f = dynamic_cast *>(&other); + return f; + } + + int test() + { + return 100; + } + static Ptr> typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast>(ptr); + } + + virtual bool isSameSize(const Frame &other) const + { + const ToFRawIQFrameTemplate *f = dynamic_cast *>(&other); + return (f && size == f->size); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + + _i.size()*sizeof(ByteType) + + _q.size()*sizeof(ByteType) + + sizeof(uint32_t)*2; + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + uint32_t x; + x = sizeof(ByteType); + object.put((const char *)&x, sizeof(x)); + + x = size.width; + object.put((const char *)&x, sizeof(x)); + x = size.height; + object.put((const char *)&x, sizeof(x)); + + object.put((const char *)_i.data(), sizeof(ByteType)*_i.size()); + object.put((const char *)_q.data(), sizeof(ByteType)*_q.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + object.get((char *)&id, sizeof(id)); + object.get((char *)×tamp, sizeof(timestamp)); + + uint32_t x; + object.get((char *)&x, sizeof(x)); + + if(x != sizeof(ByteType)) + return false; + + object.get((char *)&x, sizeof(x)); + size.width = x; + object.get((char *)&x, sizeof(x)); + size.height = x; + + _i.resize(size.width*size.height); + _q.resize(size.width*size.height); + + object.get((char *)_i.data(), sizeof(ByteType)*_i.size()); + object.get((char *)_q.data(), sizeof(ByteType)*_q.size()); + + return true; + } + + virtual ~ToFRawIQFrameTemplate() {} +}; + + +//typedef ToFRawIQFrameTemplate Int16ToFRawIQFrameTemplate; + +class POINTCLOUD_EXPORT RawDataFrame : public RawFrame +{ +public: + Vector data; + + virtual Ptr copy() const + { + Ptr f(new RawDataFrame()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new RawDataFrame()); + + auto *r = dynamic_cast(other.get()); + r->id = id; + r->timestamp = timestamp; + r->data = data; + return other; + } + + virtual Ptr newFrame() const + { + RawDataFrame *r = new RawDataFrame(); + r->data.resize(data.size()); + return FramePtr(r); + } + + virtual bool isSameType(const Frame &other) const + { + const RawDataFrame *f = dynamic_cast(&other); + return f; + } + + virtual bool isSameSize(const Frame &other) const + { + const RawDataFrame *f = dynamic_cast(&other); + return f && data.size() == f->data.size(); + } + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + data.size()*sizeof(ByteType) + sizeof(size_t); + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + s = data.size(); + object.put((const char *)&s, sizeof(s)); + + object.put((const char *)data.data(), sizeof(ByteType)*data.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + size_t s; + if(!object.get((char *)&id, sizeof(id)) || + !object.get((char *)×tamp, sizeof(timestamp)) || + !object.get((char *)&s, sizeof(s))) + return false; + + data.resize(s); + + return object.get((char *)data.data(), sizeof(ByteType)*data.size()); + } + + virtual ~RawDataFrame() {} +}; + +typedef Ptr RawDataFramePtr; + +class POINTCLOUD_EXPORT PointCloudFrame : public Frame +{ +public: + virtual SizeType size() const = 0; + virtual Point *operator [](IndexType index) = 0; + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~PointCloudFrame() {} +}; + +typedef Ptr PointCloudFramePtr; + +template +class POINTCLOUD_EXPORT PointCloudFrameTemplate: public PointCloudFrame +{ +public: + Vector points; + + virtual SizeType size() const + { + return points.size(); + } + + virtual Point *operator[] (IndexType index) + { + if(index < points.size() && index >= 0) + return &points[index]; + else + return 0; + } + + virtual Ptr copy() const + { + Ptr f(new PointCloudFrameTemplate()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new PointCloudFrameTemplate()); + + auto *p = dynamic_cast *>(other.get()); + p->id = id; + p->timestamp = timestamp; + p->points = points; + return other; + } + + virtual Ptr newFrame() const + { + PointCloudFrameTemplate *p = new PointCloudFrameTemplate(); + p->points.resize(points.size()); + return FramePtr(p); + } + + virtual bool isSameType(const Frame &other) const + { + const PointCloudFrameTemplate *f = dynamic_cast *>(&other); + return f; + } + + virtual bool isSameSize(const Frame &other) const + { + const PointCloudFrameTemplate *f = dynamic_cast *>(&other); + return f && f->size() == size(); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + points.size()*sizeof(PointType) + sizeof(size_t); + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + s = points.size(); + object.put((const char *)&s, sizeof(s)); + + object.put((const char *)points.data(), sizeof(PointType)*points.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + object.get((char *)&id, sizeof(id)); + object.get((char *)×tamp, sizeof(timestamp)); + + size_t s; + object.get((char *)&s, sizeof(s)); + + points.resize(s); + + object.get((char *)points.data(), sizeof(ByteType)*points.size()); + return true; + } + + static Ptr> typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast>(ptr); + } + + virtual ~PointCloudFrameTemplate() {} +}; + +typedef PointCloudFrameTemplate XYZPointCloudFrame; +typedef PointCloudFrameTemplate XYZIPointCloudFrame; + +typedef Ptr XYZPointCloudFramePtr; + +//#if defined(WINDOWS) +//fixed error LNK2019 and error LNK2001 can't find symbol in windows platform +//coz template class can't export symbol in header file +template class POINTCLOUD_EXPORT PointCloudFrameTemplate; +template class POINTCLOUD_EXPORT PointCloudFrameTemplate; +template class POINTCLOUD_EXPORT ToFRawFrameTemplate; +template class POINTCLOUD_EXPORT ToFRawIQFrameTemplate; +//#endif +/** + * @} + */ + +} + +#endif // POINTCLOUD_POINT_H diff --git a/libs/macos/include/pointcloud-1.0.0/FrameBuffer.h b/libs/macos/include/pointcloud-1.0.0/FrameBuffer.h new file mode 100644 index 0000000..8534377 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/FrameBuffer.h @@ -0,0 +1,123 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAMEBUFFER_H +#define POINTCLOUD_FRAMEBUFFER_H + +#include +#include + +#include + +#define MAX_FRAME_BUFFERS 2 + +namespace PointCloud +{ + +/** + * \addtogroup Frm + * @{ + */ + + +template +class FrameBufferManager; + +// Auto-releases the obtained buffer when FrameBuffer<> instance is terminated +template +class FrameBuffer: public Ptr +{ +public: + typedef Ptr BufferPtr; + +protected: + BufferPtr &_buffer; + + FrameBufferManager &_manager; + +public: + FrameBuffer(BufferPtr &buffer, FrameBufferManager &manager): _buffer(buffer), _manager(manager), + Ptr(nullptr, [&manager, &buffer](BufferType *) { manager.release(buffer); }) // The deleter gets called when FrameBuffer<> goes out of scope. Deleter releases the held buffer + {} + + inline BufferPtr &operator *() { return _buffer; } + + virtual ~FrameBuffer() {} +}; + +// This maintains a minimum number of buffers for use and re-use. +// Call to release() on unused buffers is important for it be either freed or reused +template +class FrameBufferManager +{ +public: + typedef Ptr BufferPtr; + typedef FrameBuffer FrameBufferType; + +protected: + List _inUse; + List _available; + + SizeType _minimumBufferCount; + +public: + FrameBufferManager(SizeType minBufferCount): _minimumBufferCount(minBufferCount) + { + for(auto i = 0; i < minBufferCount; i++) + _available.push_back(BufferPtr()); + } + + inline void setMinimumBufferCount(SizeType minBufferCount) + { + _minimumBufferCount = (minBufferCount > 0)?minBufferCount:MAX_FRAME_BUFFERS; + } + + inline SizeType getMinimumBufferCount() const + { + return _minimumBufferCount; + } + + FrameBufferType get() + { + if(_available.size() > 0) + _inUse.splice(_inUse.begin(), _available, _available.begin()); + else + _inUse.push_front(BufferPtr()); + + return FrameBufferType(*_inUse.begin(), *this); + } + + bool release(BufferPtr &p) + { + auto f = std::find(_inUse.begin(), _inUse.end(), p); + + if(f == _inUse.end()) + return false; + + if(_available.size() < _minimumBufferCount) + _available.splice(_available.begin(), _inUse, f); + else + _inUse.erase(f); + + return true; + } + + void clear() + { + _inUse.clear(); + _available.clear(); + } + + virtual ~FrameBufferManager() { clear(); } +}; + +/** + * @} + */ + +} + +#endif // FRAMEBUFFER_H diff --git a/libs/macos/include/pointcloud-1.0.0/FrameStream.h b/libs/macos/include/pointcloud-1.0.0/FrameStream.h new file mode 100644 index 0000000..7d44aad --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/FrameStream.h @@ -0,0 +1,193 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAME_STREAM_H +#define POINTCLOUD_FRAME_STREAM_H + +#include +#include +#include "DataPacket.h" + +namespace PointCloud +{ + + class CameraSystem; + class POINTCLOUD_EXPORT FrameGenerator; + typedef Ptr FrameGeneratorPtr; + + + struct POINTCLOUD_EXPORT FrameStreamHeader + { + char version[2]; // 0 -> major, 1 -> minor + GeneratorIDType generatorIDs[3]; // For raw (processed), depth and point cloud, in that order + }; + + struct POINTCLOUD_EXPORT FrameStreamPacket: public DataPacket + { + enum PacketType + { + PACKET_DATA = 0, + PACKET_GENERATOR_CONFIG = 1 + }; + + FrameStreamPacket(): DataPacket() {} + }; + + struct POINTCLOUD_EXPORT GeneratorConfigurationSubPacket + { + uint8_t frameType; + uint32_t size; + SerializedObject config; + + bool read(SerializedObject &object); + bool write(SerializedObject &object); + }; + + class POINTCLOUD_EXPORT FrameStreamWriter + { + OutputFileStream &_stream; + OutputFileStream _internalStream; + + Mutex _mutex; + + bool _isPaused = false; + + size_t _frameCount; + FrameStreamHeader _header; + FrameStreamPacket _rawpacket, _configPacket; + GeneratorConfigurationSubPacket _generatorConfigSubPacket; + + bool _writeHeader(); + + bool _init(GeneratorIDType processedRawFrameGeneratorID, GeneratorIDType depthFrameGeneratorID, GeneratorIDType pointCloudFrameGeneratorID); + + public: + FrameStreamWriter(const String &filename, GeneratorIDType processedRawFrameGeneratorID, GeneratorIDType depthFrameGeneratorID, GeneratorIDType pointCloudFrameGeneratorID); + FrameStreamWriter(OutputFileStream &stream, GeneratorIDType processedRawFrameGeneratorID, GeneratorIDType depthFrameGeneratorID, GeneratorIDType pointCloudFrameGeneratorID); + + inline bool isStreamGood() { return _stream.good(); } + + bool pause(); + bool resume(); + inline bool isPaused() { return _isPaused; } + + bool write(FramePtr rawUnprocessed); + + inline SerializedObject &getConfigObject() { return _generatorConfigSubPacket.config; } + bool writeGeneratorConfiguration(uint frameType); + // Assumes the config sub-packet has been populated by using getConfigObject() + + bool close(); + + virtual ~FrameStreamWriter() { close(); } + + + }; + + typedef Ptr FrameStreamWriterPtr; + + class POINTCLOUD_EXPORT FrameStreamReader + { + InputFileStream &_stream; + InputFileStream _internalStream; + + Vector _allPacketOffsets; + + Vector _dataPacketLocation, _configPacketLocation; + + FrameStreamHeader _header; + + size_t _currentPacketIndex; // index on _allPacketOffsets + size_t _currentFrameIndex; // index on _dataPacketLocation + + CameraSystem &_sys; + + FrameGeneratorPtr _frameGenerator[3]; // for processed raw, depth and point cloud + + FrameStreamPacket _dataPacket, _configPacket; + GeneratorConfigurationSubPacket _configSubPacket; + + bool _init(); + + bool _getPacket(size_t packetIndex, FrameStreamPacket &packet); + bool _readConfigPacket(size_t packetIndex); + + public: + + FrameStreamReader(const String &fileName, CameraSystem &sys); + FrameStreamReader(InputFileStream &stream, CameraSystem &sys); + + inline bool isStreamGood() { return _stream.good(); } + + Vector frames; // 4 entries - raw (2 types), depth and point cloud corresponding to currently read frame index + + bool readNext(); + bool seekTo(size_t position); + + FrameStreamHeader *getFrameHeader() + { + return &_header; + } + FrameStreamPacket *getFrameConfigPacket(int idx) + { + if(idx<0||idx>4) + { + return NULL; + } + bool ret= _getPacket(idx, _configPacket); + if(!ret) + { + return NULL; + } + return &_configPacket; + + } + FrameStreamPacket *getFrameCurrDataPacket() + { + return &_dataPacket; + } + + inline size_t currentPosition() { return _currentFrameIndex; } + inline size_t size() { return _dataPacketLocation.size(); } + + template + bool getStreamParam(const String &name, T &value) const; + + bool close(); + + virtual ~FrameStreamReader() {} + }; + + typedef Ptr FrameStreamReaderPtr; + + class POINTCLOUD_EXPORT SocketStreamReader + { + CameraSystem &_sys; + FrameGeneratorPtr _frameGenerator[3]; // for processed raw, depth and point cloud + FrameStreamPacket _dataPacket; + bool _init(); + uint _id1; + uint _id2; + uint _id3; + SerializedObject object; + PointCloud::String _config1; + PointCloud::String _config2; + PointCloud::String _config3; + public: + SocketStreamReader(CameraSystem &sys,uint id1,uint id2,uint id3,char *config1,int len1,char *config2,int len2,char *config3,int len3); + + bool readNext(char *ptr,int tsize); + + template + bool getStreamParam(const String &name, T &value) const; + Vector frames; + virtual ~SocketStreamReader() {} + }; + + typedef Ptr SocketStreamReaderPtr; +} + +#endif diff --git a/libs/macos/include/pointcloud-1.0.0/Logger.h b/libs/macos/include/pointcloud-1.0.0/Logger.h new file mode 100644 index 0000000..a3f738f --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Logger.h @@ -0,0 +1,208 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_LOGGER_H +#define POINTCLOUD_LOGGER_H + +#include +#include +#include + +#include "Common.h" + +namespace PointCloud +{ + +/** + * \addtogroup Util + * @{ + */ + +enum LogLevel +{ + LOG_CRITICAL, + LOG_ERROR, + LOG_WARNING, + LOG_INFO, + LOG_DEBUG +}; + +typedef OutputStream &(*OStreamManipulator)(OutputStream &); + +class POINTCLOUD_EXPORT LoggerOutStream +{ +public: + typedef Function LoggerOutStreamFunctionType; +protected: + LoggerOutStreamFunctionType _outputFunction; + + OutputStringStream _s; + +public: + LoggerOutStream() {} + + void setOutputFunction(LoggerOutStreamFunctionType o) { _outputFunction = o; } + + template + LoggerOutStream &operator <<(const T &value) + { + if(!_outputFunction) + return *this; + + _s << value; + + if(_s.tellp() > 0) // Something written? + { + _outputFunction(_s.str()); + _s.clear(); + _s.str(""); + } + return *this; + } + + inline LoggerOutStream &operator <<(OStreamManipulator manip) + { + (*manip)(_s); + return *this; + } +}; + +class POINTCLOUD_EXPORT Logger +{ +protected: + OutputStream &_out = std::cerr; + + mutable Mutex _mutex; + + LogLevel _logLevel, // Allow log statements equal to or below _logLevel + _currentLogLevel; // This holds log level for current statements + + static const String _logLevelNames[5]; + + Map _outputStreams; + IndexType _outputStreamCount = 0; + +public: + Logger(LogLevel loglevel = LOG_ERROR): _logLevel(loglevel), _currentLogLevel(loglevel) + {} + + Logger &operator =(const Logger &other) { _logLevel = other._logLevel; _currentLogLevel = other._currentLogLevel; return *this; } + + inline Logger &operator()(LogLevel loglevel) + { + _currentLogLevel = loglevel; + return *this << _logLevelNames[loglevel] << ": "; + } + + inline LogLevel getDefaultLogLevel() + { + return _logLevel; + } + + inline LogLevel getCurrentLogLevel() + { + return _currentLogLevel; + } + + inline void setDefaultLogLevel(LogLevel loglevel) + { + _logLevel = loglevel; + } + + inline OutputStream &getStream() + { + return _out; + } + + inline IndexType addOutputStream(LoggerOutStream::LoggerOutStreamFunctionType f) + { + IndexType i = _outputStreamCount; + _outputStreams[i].setOutputFunction(f); + _outputStreamCount++; + return i; + } + + inline bool removeOutputStream(IndexType index) + { + auto x = _outputStreams.find(index); + + if(x != _outputStreams.end()) + { + _outputStreams.erase(x); + return true; + } + return false; + } + + template + Logger &operator <<(const T &value) + { + if(_currentLogLevel <= _logLevel) + { + _out << value; + + for(auto &x: _outputStreams) + x.second << value; + } + return *this; + } + + typedef Logger &(*LoggerManipulator)(Logger &); + + inline Logger &operator <<(LoggerManipulator manip) + { + if(_currentLogLevel <= _logLevel) + return (*manip)(*this); + else + return *this; + } + + inline Logger &operator <<(OStreamManipulator manip) + { + if(_currentLogLevel <= _logLevel) + { + (*manip)(_out); + + for(auto &x: _outputStreams) + x.second << manip; + } + return *this; + } + + virtual ~Logger() + { + } +}; + +extern Logger POINTCLOUD_EXPORT logger; + +//POINTCLOUD_EXPORT Logger & endl(Logger &l); + +class POINTCLOUD_EXPORT LogLevelChanger +{ + LogLevel _currentLogLevel; + LogLevel _desiredLogLevel; +public: + LogLevelChanger(LogLevel desired): _desiredLogLevel(desired) + { + _currentLogLevel = logger.getDefaultLogLevel(); + logger.setDefaultLogLevel(_desiredLogLevel); + } + + ~LogLevelChanger() + { + logger.setDefaultLogLevel(_currentLogLevel); + } +}; + +/** + * @} + */ + + +} + +#endif // POINTCLOUD_LOGGER_H \ No newline at end of file diff --git a/libs/macos/include/pointcloud-1.0.0/Point.h b/libs/macos/include/pointcloud-1.0.0/Point.h new file mode 100644 index 0000000..d6352b2 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Point.h @@ -0,0 +1,135 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_POINT_H +#define POINTCLOUD_POINT_H + +#define _USE_MATH_DEFINES +#include + +#include + +#include "Common.h" + +namespace PointCloud +{ +/** + * \addtogroup Frm + * @{ + */ + + +class Point +{ +public: + float x, y, z; // in meters + + Point(): x(0), y(0), z(0) {} + Point(float x, float y): x(x), y(y), z(0) {} + Point(float x, float y, float z): x(x), y(y), z(z) {} + + inline float angle(const Point &other) const; + inline float norm() const; + + inline float dot(const Point &other) const; + inline Point cross(const Point &other) const; + + inline Point &operator -(); + inline Point operator +(const Point &other) const; + inline Point operator *(const Point &other) const; + inline Point operator *(const float &other) const; +}; + +float Point::dot(const Point &other) const +{ + return (x*other.x + y*other.y + z*other.z); +} + +Point Point::cross(const Point &other) const +{ + Point p; + p.x = y*other.z - z*other.y; + p.y = z*other.x - x*other.z; + p.z = x*other.y - y*other.x; + + return p; +} + + +float Point::angle(const Point &other) const +{ + float n1 = norm(), n2 = other.norm(); + + if(floatEquals(n1, 0) || floatEquals(n2, 0)) + return 0; + + return acos(dot(other)/n1/n2); +} + +float Point::norm() const +{ + return sqrt(x*x + y*y + z*z); +} + +inline Point &Point::operator -() +{ + x = -x; + y = -y; + z = -z; + return *this; +} + +Point Point::operator*(const Point &other) const +{ + return Point(x*other.x, y*other.y, z*other.z); +} + +Point Point::operator*(const float &other) const +{ + return Point(x*other, y*other, z*other); +} + +Point Point::operator +(const Point &other) const +{ + return Point(x + other.x, y + other.y, z + other.z); +} + + + +class POINTCLOUD_EXPORT IntensityPoint: public Point +{ +public: + float i; // normalized 0-1 + + static IntensityPoint *typeCast(Point *ptr) + { + return (IntensityPoint *)(ptr); + } +}; + +class RGBPoint: public Point +{ +public: + float r, g, b; // normalized 0-1 + + static RGBPoint *typeCast(Point *ptr) + { + return (RGBPoint *)(ptr); + } +}; + +class Orientation // in radial co-ordinates +{ +public: + float theta, phi; // in radians +}; +/** + * @} + */ + +} + +#endif // POINTCLOUD_POINT_H diff --git a/libs/macos/include/pointcloud-1.0.0/PointCloudConfig.h b/libs/macos/include/pointcloud-1.0.0/PointCloudConfig.h new file mode 100644 index 0000000..970c698 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/PointCloudConfig.h @@ -0,0 +1,16 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_CONFIG_H +#define POINTCLOUD_CONFIG_H + +#define POINTCLOUD_ABI_VERSION 0 +#define POINTCLOUD_MAJOR_VERSION 1 +#define POINTCLOUD_MINOR_VERSION 0 +#define POINTCLOUD_PATCH_VERSION 0 +#define POINTCLOUD_CONF_VERSION 1 + +#endif diff --git a/libs/macos/include/pointcloud-1.0.0/PointCloudExports.h b/libs/macos/include/pointcloud-1.0.0/PointCloudExports.h new file mode 100644 index 0000000..538f576 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/PointCloudExports.h @@ -0,0 +1,42 @@ + +#ifndef POINTCLOUD_EXPORT_H +#define POINTCLOUD_EXPORT_H + +#ifdef POINTCLOUD_STATIC_DEFINE +# define POINTCLOUD_EXPORT +# define POINTCLOUD_NO_EXPORT +#else +# ifndef POINTCLOUD_EXPORT +# ifdef pointcloud_EXPORTS + /* We are building this library */ +# define POINTCLOUD_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define POINTCLOUD_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef POINTCLOUD_NO_EXPORT +# define POINTCLOUD_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef POINTCLOUD_DEPRECATED +# define POINTCLOUD_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef POINTCLOUD_DEPRECATED_EXPORT +# define POINTCLOUD_DEPRECATED_EXPORT POINTCLOUD_EXPORT POINTCLOUD_DEPRECATED +#endif + +#ifndef POINTCLOUD_DEPRECATED_NO_EXPORT +# define POINTCLOUD_DEPRECATED_NO_EXPORT POINTCLOUD_NO_EXPORT POINTCLOUD_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef POINTCLOUD_NO_DEPRECATED +# define POINTCLOUD_NO_DEPRECATED +# endif +#endif + +#endif /* POINTCLOUD_EXPORT_H */ diff --git a/libs/macos/include/pointcloud-1.0.0/Ptr.h b/libs/macos/include/pointcloud-1.0.0/Ptr.h new file mode 100644 index 0000000..91cf0a1 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Ptr.h @@ -0,0 +1,65 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_PTR_H +#define POINTCLOUD_PTR_H + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Util + * @{ + */ + + +template +void deleter(T *data) +{ + delete data; +} + + +/** + * NOTE: This is a simple way to ensure that matching new/delete are used. + * WARNING: + * 1. DO NOT CREATE the pointer "data" in some other library (so/dll) context and pass it to Ptr<> created in another library (so/dll). + * Always. create Ptr<> and allocate "data" in the same so/dll. + * 2. DO NOT USE THIS CLASS FOR array data, that is, allocated with new[] + */ +template +class Ptr: public std::shared_ptr +{ +public: + Ptr(T *data): std::shared_ptr(data, deleter) {} + + template + Ptr(T *data, _Deleter d): std::shared_ptr(data, d) {} + + Ptr(): std::shared_ptr() {} + + Ptr(const std::shared_ptr &p): std::shared_ptr(p) {} + +#ifdef SWIG + T *operator ->() { return this->std::shared_ptr::operator->(); } + + const T *operator ->() const { return this->std::shared_ptr::operator->(); } +#endif + + virtual ~Ptr() {} +}; + +/** + * @} + */ + + +} + + +#endif // POINTCLOUD_PTR_H \ No newline at end of file diff --git a/libs/macos/include/pointcloud-1.0.0/SerializedObject.h b/libs/macos/include/pointcloud-1.0.0/SerializedObject.h new file mode 100644 index 0000000..283e13b --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/SerializedObject.h @@ -0,0 +1,86 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_SERIALIZED_OBJECT_H +#define POINTCLOUD_SERIALIZED_OBJECT_H + +#include "Common.h" + +#include + +#include + +namespace PointCloud +{ + +class POINTCLOUD_EXPORT SerializedObject +{ +protected: + Vector _bytes; + uint _getOffset, _putOffset; + +public: + SerializedObject(size_t size): _bytes(size), _getOffset(0), _putOffset(0) {} + SerializedObject(): _getOffset(0), _putOffset(0) {} + + uint currentGetOffset() const { return _getOffset; } + uint currentPutOffset() const { return _putOffset; } + + const Vector &getBytes() const { return _bytes; } + Vector &getBytes() { return _bytes; } + + inline void resize(size_t size) + { + if(size > 0) + _bytes.resize(size); + else + _bytes.clear(); + rewind(); + } + + inline size_t size() const { return _bytes.size(); } + + inline void rewind() { _getOffset = 0; _putOffset = 0; } + + inline size_t get(char *bytes, size_t size); + inline size_t put(const char *bytes, size_t size); + + virtual ~SerializedObject() {} +}; + +size_t SerializedObject::get(char *bytes, size_t size) +{ + size = std::min(size, _bytes.size() - _getOffset); + + if(size == 0) + return 0; + + memcpy(bytes, _bytes.data() + _getOffset, size); + + _getOffset += size; + + return size; +} + +size_t SerializedObject::put(const char *bytes, size_t size) +{ + size = std::min(size, _bytes.size() - _putOffset); + + if(size == 0) + return 0; + + memcpy(_bytes.data() + _putOffset, bytes, size); + + _putOffset += size; + + return size; +} + + +} + + +#endif diff --git a/libs/macos/include/pointcloud-1.0.0/Streamer.h b/libs/macos/include/pointcloud-1.0.0/Streamer.h new file mode 100644 index 0000000..3fda226 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Streamer.h @@ -0,0 +1,62 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_STREAMER_H +#define POINTCLOUD_STREAMER_H + +#include "Device.h" +#include "Frame.h" +#include "VideoMode.h" +#include "Timer.h" + +namespace PointCloud +{ +/** + * \addtogroup IO + * @{ + */ + + +class POINTCLOUD_EXPORT Streamer +{ +protected: + DevicePtr _device; + + Timer _time; + + int _currentID = -1; + TimeStampType _currentTimeStamp = 0; + + bool _isRunning = false; + + virtual bool _start() = 0; + virtual bool _capture(RawDataFramePtr &p) = 0; + virtual bool _stop() = 0; + +public: + Streamer(DevicePtr device): _device(device) {} + + virtual ~Streamer(); + + virtual bool isInitialized() = 0; + virtual bool isRunning() { return _isRunning; } + + virtual bool start(); + virtual bool capture(RawDataFramePtr &p); + virtual bool stop(); + + virtual bool getSupportedVideoModes(Vector &videoModes) = 0; + + virtual bool getCurrentVideoMode(VideoMode &videoMode) = 0; + virtual bool setVideoMode(const VideoMode &videoMode) = 0; +}; +/** + * @} + */ + +} + +#endif // STREAMER_H diff --git a/libs/macos/include/pointcloud-1.0.0/Timer.h b/libs/macos/include/pointcloud-1.0.0/Timer.h new file mode 100644 index 0000000..2dd32e5 --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/Timer.h @@ -0,0 +1,49 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_TIME_H +#define POINTCLOUD_TIME_H + +#include "Common.h" + +namespace PointCloud +{ + +/** + * \addtogroup Util + * @{ + */ + + +class POINTCLOUD_EXPORT Timer +{ + TimeStampType _realTimeStart = 0, _monoticStart = 0; + + bool _initialized = false; + +public: + Timer() + { + init(); + } + + inline bool isInitialized() { return _initialized; } + + bool init(); + + // Assumption: MONOTIC clock's epoch began recently while REALTIME's epoch began a long time ago (~44 years ago) + TimeStampType convertToRealTime(TimeStampType l); + + TimeStampType getCurrentRealTime(); +}; + +/** + * @} + */ + +} + +#endif // POINTCLOUD_TIME_H diff --git a/libs/macos/include/pointcloud-1.0.0/VideoMode.h b/libs/macos/include/pointcloud-1.0.0/VideoMode.h new file mode 100644 index 0000000..b75433d --- /dev/null +++ b/libs/macos/include/pointcloud-1.0.0/VideoMode.h @@ -0,0 +1,95 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_VIDEO_MODE_H +#define POINTCLOUD_VIDEO_MODE_H + +#include + +namespace PointCloud +{ +/** + * \addtogroup Frm + * @{ + */ + +class FrameSize +{ +public: + uint32_t width, height; + + inline bool operator ==(const FrameSize &other) const + { + return width == other.width && height == other.height; + } + + inline bool operator !=(const FrameSize &other) const + { + return !operator==(other); + } +}; + +class RegionOfInterest: public FrameSize +{ +public: + uint32_t x, y; + + inline bool operator ==(const RegionOfInterest &other) const + { + return width == other.width && height == other.height && x == other.x && y == other.y; + } + + inline bool operator !=(const RegionOfInterest &other) const + { + return !operator==(other); + } +}; + +class FrameRate +{ +public: + uint32_t numerator, denominator; + + inline float getFrameRate() const { return (denominator == 0)?0:(((float)numerator)/denominator); } +}; + +class VideoMode +{ +public: + FrameSize frameSize; + FrameRate frameRate; + + inline float getFrameRate() const { return frameRate.getFrameRate(); } +}; + +class SupportedVideoMode: public VideoMode +{ +public: + uint8_t bytesPerPixel; + + SupportedVideoMode(): bytesPerPixel(0) + { + frameSize.width = frameSize.height = 0; + frameRate.numerator = 0; + frameRate.denominator = 1; + } + + SupportedVideoMode(uint32_t width, uint32_t height, uint32_t rateNumerator, uint32_t rateDenominator, uint8_t bytesPerPixel) + { + frameSize.width = width; + frameSize.height = height; + frameRate.numerator = rateNumerator; + frameRate.denominator = rateDenominator; + this->bytesPerPixel = bytesPerPixel; + } +}; +/** + * @} + */ + +} + +#endif // POINTCLOUD_POINT_H diff --git a/libs/macos/lib/cmake/PointCloud/PointCloudConfig.cmake b/libs/macos/lib/cmake/PointCloud/PointCloudConfig.cmake new file mode 100644 index 0000000..21ceec5 --- /dev/null +++ b/libs/macos/lib/cmake/PointCloud/PointCloudConfig.cmake @@ -0,0 +1,19 @@ +# - Config file for the FooBar package +# It defines the following variables +# POINTCLOUD_INCLUDE_DIRS - include directories for FooBar +# POINTCLOUD_LIBRARIES - libraries to link against + +# Compute paths +get_filename_component(POINTCLOUD_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(POINTCLOUD_INCLUDE_DIRS ${POINTCLOUD_CMAKE_DIR}/../../../include/pointcloud-1.0.0 ${POINTCLOUD_CMAKE_DIR}/../../../../../3party/macos/libusb1.0.0/include;Util/) +#set(POINTCLOUD_INCLUDE_DIRS ${POINTCLOUD_CMAKE_DIR}/../../../include/pointcloud-1.0.0 COMMON_INCLUDE) + +set(POINTCLOUD_ABI_VERSION 0) + +# Our library dependencies (contains definitions for IMPORTED targets) +if(NOT TARGET PointCloud::pointcloud AND NOT PointCloud_BINARY_DIR) + include("${POINTCLOUD_CMAKE_DIR}/PointCloudTargets.cmake") +endif() + +# These are IMPORTED targets created by FooBarTargets.cmake +set(POINTCLOUD_LIBRARIES PointCloud::pointcloud) diff --git a/libs/macos/lib/cmake/PointCloud/PointCloudConfigVersion.cmake b/libs/macos/lib/cmake/PointCloud/PointCloudConfigVersion.cmake new file mode 100644 index 0000000..e4f4fc8 --- /dev/null +++ b/libs/macos/lib/cmake/PointCloud/PointCloudConfigVersion.cmake @@ -0,0 +1,11 @@ +set(PACKAGE_VERSION "1.0.0") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/libs/macos/lib/cmake/PointCloud/PointCloudTargets.cmake b/libs/macos/lib/cmake/PointCloud/PointCloudTargets.cmake new file mode 100644 index 0000000..51c8568 --- /dev/null +++ b/libs/macos/lib/cmake/PointCloud/PointCloudTargets.cmake @@ -0,0 +1,98 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget PointCloud::pointcloud) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target PointCloud::pointcloud +add_library(PointCloud::pointcloud SHARED IMPORTED) + +set_target_properties(PointCloud::pointcloud PROPERTIES + INTERFACE_LINK_LIBRARIES "usb-1.0;dl" +) + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/PointCloudTargets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/libs/macos/lib/libpointcloud.dylib b/libs/macos/lib/libpointcloud.dylib new file mode 100755 index 0000000..8d23688 Binary files /dev/null and b/libs/macos/lib/libpointcloud.dylib differ diff --git a/libs/macos/lib/libusb-1.0.0.dylib b/libs/macos/lib/libusb-1.0.0.dylib new file mode 100644 index 0000000..6244522 Binary files /dev/null and b/libs/macos/lib/libusb-1.0.0.dylib differ diff --git a/libs/macos/lib/log.txt b/libs/macos/lib/log.txt new file mode 100644 index 0000000..8db14ed --- /dev/null +++ b/libs/macos/lib/log.txt @@ -0,0 +1,1238 @@ + all in one setStatusBar +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: end of init + all in one setStatusBar +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail:device left... +get new devices vid=0451, pid=9107 + +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +DEBUG: Get USB device vid:1105 pid:37127 serail:1921588697 +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: end of init + all in one setStatusBar +DEBUG: Get USB device vid:1204 pid:37129 serail: +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +INFO: CameraSystem:: interface id 0,device id 04b4:9109,id=0::04b4:9109:: +DEBUG: SonyCDKCameraFactory: new Sony camera 0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: USBIO: Init device0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +INFO: ParameterDMLParser: Found register map with name 'SonyIMX556' (v1.0) +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '2580' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '2580' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '82240' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '82240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7690' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7730' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84480' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84480' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84481' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84481' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20600' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20600' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20610' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20610' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20580' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41100' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41110' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41120' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52850' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51710' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51710' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '53070' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '53070' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51200' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51230' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51740' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51760' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51780' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51820' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51860' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51940' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51980' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86600' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164050' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86490' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86500' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86510' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86530' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86550' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86280' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86281' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86290' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86291' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86300' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86301' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86310' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86311' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86160' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86161' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86162' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86163' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86170' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86171' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86172' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86173' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86201' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86202' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86203' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86211' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86212' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86213' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86241' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86242' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86243' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86250' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86251' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86252' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86253' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41030' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41620' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41660' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41680' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86390' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82220' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40960' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40960' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40970' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40970' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '112770' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120370' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '124010' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43070' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211250' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100001' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100002' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100003' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100003' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100004' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100004' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100005' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100006' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100007' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100008' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100009' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200001' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200002' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200003' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200004' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200005' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200006' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200007' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200008' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200009' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '200010' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '200010' +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '200011' +DEBUG: ParameterDMLParser: Adding int parameter with id = '300001' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '300002' +DEBUG: ParameterDMLParser: Adding int parameter with id = '300003' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '300004' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '300004' +DEBUG: ParameterDMLParser: Total number of valid parameters = 144 +DEBUG: ParameterDMLParser: Total number of valid parameters = 137 +DEBUG: DepthCamera: Setting parameter 'unambiguous_range' +DEBUG: DepthCamera: Setting parameter 'intg_time' +DEBUG: set integration sub_fnum:4 integrationDutyCycle:120000 +DEBUG: DepthCamera: Setting parameter 'mod_freq1' +DEBUG: DepthCamera: Setting parameter 'sub_rseq_lnum' +DEBUG: DepthCamera: Setting parameter 'rngchken' +DEBUG: DepthCamera: Setting parameter 'dutof_mode' +DEBUG: DepthCamera: Setting parameter 'hmax' +DEBUG: DepthCamera: Setting parameter 'micr_lnum' +DEBUG: DepthCamera: Setting parameter 'dpth_su_num' +DEBUG: DepthCamera: Setting parameter 'binning_mode' +DEBUG: DepthCamera: Setting parameter 'phases_num' +DEBUG: set sub_fnum:8 +DEBUG: DepthCamera: Setting parameter 'dlycnt' +DEBUG: DepthCamera: Setting parameter 'anadlycnt' +DEBUG: DepthCamera: Setting parameter 'dlycntsf' +INFO: CameraSystem: Successfully refreshed parameters for SonyCDKCamera(0::04b4:9109::). addItem prifle id : 130 + d.getCurrentCameraProfileID() : 130 + mode_list setCurrentIndex === 0 : + mode_list text Normal + +CalibrationStatus: Calibration invalid for - Pixelwise Phase Offset, Common Phase Offset, Temperature. + +DEBUG: VoxelProgrammerBase: register write @0x69 = 1 +DEBUG: table @0 = 0, 1 +DEBUG: table @1 = 0.707107, 0.707107 +DEBUG: table @2 = 1, 6.12323e-17 +DEBUG: table @3 = 0.707107, -0.707107 +DEBUG: table @4 = 1.22465e-16, -1 +DEBUG: table @5 = -0.707107, -0.707107 +DEBUG: table @6 = -1, -1.83697e-16 +DEBUG: table @7 = -0.707107, 0.707107 +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: ToFSonyFrameGenerator:setParameters pixelwise enable:1 phaseOffsetFileName:SonyCDKCamera70cm8phase60mhzPhaseOffset.bin data size:307203 +DEBUG: table @0 = 0, 1 +DEBUG: table @1 = 0.707107, 0.707107 +DEBUG: table @2 = 1, 6.12323e-17 +DEBUG: table @3 = 0.707107, -0.707107 +DEBUG: table @4 = 1.22465e-16, -1 +DEBUG: table @5 = -0.707107, -0.707107 +DEBUG: table @6 = -1, -1.83697e-16 +DEBUG: table @7 = -0.707107, 0.707107 +DEBUG: ToFSonyCamera: Starting with 640x480@6fps end of init +Using rate factor = 0.1 +Using rate factor = 0.129430996693 +Using rate factor = 0.129474679168 +Using rate factor = 0.129401228883 + +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:25 invalidPhases:1 return lens:350604 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552636227356839 validFrames:0 +DEBUG: time duration buffer time:8338905 fps:3.59759 paser time:30 link_device onclick : False +linkDeviceControl : False + +INFO: DepthCamera: closeFrameStream and stop. +DEBUG: DepthCamera: Frame stream writer not present. +DEBUG: VoxelProgrammerBase: register write @0x69 = 0 +INFO: DepthCamera: Streaming stopped. +INFO: SonyCDKCamera:release usb io +INFO: USBIO: release interface +WARNING: DepthCamera:free a pointcloud depth camera link_device onclick : True +linkDeviceControl : True + +DEBUG: Get USB device vid:1204 pid:37129 serail: +DEBUG: Get USB device vid:3034 pid:33107 serail:000001000000 +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail:('getDepthCamera********************', ) + +INFO: CameraSystem:: interface id 0,device id 04b4:9109,id=0::04b4:9109:: +DEBUG: SonyCDKCameraFactory: new Sony camera 0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: USBIO: Init device0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +INFO: ParameterDMLParser: Found register map with name 'SonyIMX556' (v1.0) +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '2580' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '2580' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '82240' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '82240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7690' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7730' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84480' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84480' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84481' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84481' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20600' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20600' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20610' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20610' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20580' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41100' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41110' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41120' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52850' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51710' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51710' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '53070' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '53070' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51200' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51230' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51740' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51760' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51780' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51820' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51860' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51940' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51980' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86600' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164050' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86490' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86500' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86510' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86530' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86550' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86280' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86281' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86290' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86291' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86300' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86301' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86310' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86311' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86160' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86161' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86162' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86163' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86170' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86171' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86172' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86173' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86201' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86202' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86203' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86211' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86212' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86213' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86241' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86242' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86243' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86250' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86251' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86252' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86253' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41030' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41620' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41660' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41680' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86390' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82220' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40960' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40960' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40970' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40970' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '112770' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120370' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '124010' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43070' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211250' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100001' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100002' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100003' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100003' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100004' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100004' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100005' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100006' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100007' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100008' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100009' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200001' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200002' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200003' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200004' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200005' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200006' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200007' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200008' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200009' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '200010' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '200010' +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '200011' +DEBUG: ParameterDMLParser: Adding int parameter with id = '300001' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '300002' +DEBUG: ParameterDMLParser: Adding int parameter with id = '300003' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '300004' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '300004' +DEBUG: ParameterDMLParser: Total number of valid parameters = 144 +DEBUG: ParameterDMLParser: Total number of valid parameters = 137 +DEBUG: DepthCamera: Setting parameter 'unambiguous_range' +DEBUG: DepthCamera: Setting parameter 'intg_time' +DEBUG: set integration sub_fnum:8 integrationDutyCycle:120000 +DEBUG: DepthCamera: Setting parameter 'mod_freq1' +DEBUG: DepthCamera: Setting parameter 'sub_rseq_lnum' +DEBUG: DepthCamera: Setting parameter 'rngchken' +DEBUG: DepthCamera: Setting parameter 'dutof_mode' +DEBUG: DepthCamera: Setting parameter 'hmax' +DEBUG: DepthCamera: Setting parameter 'micr_lnum' +DEBUG: DepthCamera: Setting parameter 'dpth_su_num' +DEBUG: DepthCamera: Setting parameter 'binning_mode' +DEBUG: DepthCamera: Setting parameter 'phases_num' +DEBUG: set sub_fnum:8 +DEBUG: DepthCamera: Setting parameter 'dlycnt' +DEBUG: DepthCamera: Setting parameter 'anadlycnt' +DEBUG: DepthCamera: Setting parameter 'dlycntsf' +INFO: CameraSystem: Successfully refreshed parameters for SonyCDKCamera(0::04b4:9109::). ProfileTool changeCameraProfile: -1 + addItem prifle id : 130 + d.getCurrentCameraProfileID() : 130 + mode_list setCurrentIndex === 0 : + mode_list text Normal + +CalibrationStatus: Calibration invalid for - Pixelwise Phase Offset, Common Phase Offset, Temperature. + +DEBUG: VoxelProgrammerBase: register write @0x69 = 1 +DEBUG: table @0 = 0, 1 +DEBUG: table @1 = 0.707107, 0.707107 +DEBUG: table @2 = 1, 6.12323e-17 +DEBUG: table @3 = 0.707107, -0.707107 +DEBUG: table @4 = 1.22465e-16, -1 +DEBUG: table @5 = -0.707107, -0.707107 +DEBUG: table @6 = -1, -1.83697e-16 +DEBUG: table @7 = -0.707107, 0.707107 +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: ToFSonyFrameGenerator:setParameters pixelwise enable:1 phaseOffsetFileName:SonyCDKCamera70cm8phase60mhzPhaseOffset.bin data size:307203 +DEBUG: table @0 = 0, 1 +DEBUG: table @1 = 0.707107, 0.707107 +DEBUG: table @2 = 1, 6.12323e-17 +DEBUG: table @3 = 0.707107, -0.707107 +DEBUG: table @4 = 1.22465e-16, -1 +DEBUG: table @5 = -0.707107, -0.707107 +DEBUG: table @6 = -1, -1.83697e-16 +DEBUG: table @7 = -0.707107, 0.707107 +DEBUG: ToFSonyCamera: Starting with 640x480@6fps +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_IO +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:1 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:2 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:3 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:4 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:5 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:6 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:7 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:8 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552636239781385 validFrames:0 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_IO +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:1 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:2 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:3 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:4 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:5 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:6 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:7 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_PIPE +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:8 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552636239842460 validFrames:0 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:1 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:2 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:3 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:4 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:5 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:6 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:7 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:8 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552636241568400 validFrames:0Using rate factor = 0.1 +Using rate factor = 0.129375669101 +Using rate factor = 0.129470211007 +Using rate factor = 0.129399325117 + +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:1 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:2 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:1 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:2 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:1 +ERROR: USBIO: Bulk transfer failed.LIBUSB_ERROR_TIMEOUT +ERROR: USBBulkPhasesStreamer frmae time out invalidFrames:2 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:21 invalidPhases:1 return lens:405900 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552636252372347 validFrames:0 +INFO: DepthCamera: closeFrameStream and stop. +DEBUG: DepthCamera: Frame stream writer not present. +DEBUG: VoxelProgrammerBase: register write @0x69 = 0 +INFO: DepthCamera: Streaming stopped. +INFO: SonyCDKCamera:release usb io +INFO: USBIO: release interface +WARNING: DepthCamera:free a pointcloud depth camera all in one setStatusBar +DEBUG: Get USB device vid:1204 pid:37129 serail: +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +INFO: CameraSystem:: interface id 0,device id 04b4:9109,id=0::04b4:9109:: +DEBUG: SonyCDKCameraFactory: new Sony camera 0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: USBIO: Init device0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +INFO: ParameterDMLParser: Found register map with name 'SonyIMX556' (v1.0) +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '2580' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '2580' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '82240' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '82240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7690' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7730' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84480' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84480' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84481' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84481' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20600' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20600' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20610' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20610' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20580' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41100' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41110' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41120' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52850' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51710' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51710' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '53070' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '53070' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51200' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51230' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51740' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51760' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51780' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51820' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51860' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51940' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51980' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86600' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164050' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86490' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86500' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86510' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86530' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86550' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86280' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86281' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86290' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86291' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86300' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86301' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86310' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86311' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86160' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86161' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86162' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86163' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86170' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86171' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86172' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86173' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86201' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86202' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86203' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86211' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86212' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86213' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86241' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86242' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86243' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86250' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86251' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86252' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86253' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41030' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41620' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41660' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41680' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86390' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82220' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40960' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40960' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40970' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40970' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '112770' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120370' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '124010' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43070' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211250' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100001' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100002' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100003' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100003' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100004' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100004' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100005' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100006' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100007' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100008' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100009' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200001' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200002' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200003' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200004' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200005' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200006' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200007' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200008' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200009' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '200010' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '200010' +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '200011' +DEBUG: ParameterDMLParser: Adding int parameter with id = '300001' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '300002' +DEBUG: ParameterDMLParser: Adding int parameter with id = '300003' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '300004' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '300004' +DEBUG: ParameterDMLParser: Total number of valid parameters = 144 +DEBUG: ParameterDMLParser: Total number of valid parameters = 137 +DEBUG: DepthCamera: Setting parameter 'unambiguous_range' +DEBUG: DepthCamera: Setting parameter 'intg_time' +DEBUG: set integration sub_fnum:4 integrationDutyCycle:120000 +DEBUG: DepthCamera: Setting parameter 'mod_freq1' +DEBUG: DepthCamera: Setting parameter 'sub_rseq_lnum' +DEBUG: DepthCamera: Setting parameter 'rngchken' +DEBUG: DepthCamera: Setting parameter 'dutof_mode' +DEBUG: DepthCamera: Setting parameter 'hmax' +DEBUG: DepthCamera: Setting parameter 'micr_lnum' +DEBUG: DepthCamera: Setting parameter 'dpth_su_num' +DEBUG: DepthCamera: Setting parameter 'binning_mode' +DEBUG: DepthCamera: Setting parameter 'phases_num' +DEBUG: set sub_fnum:8 +DEBUG: DepthCamera: Setting parameter 'dlycnt' +DEBUG: DepthCamera: Setting parameter 'anadlycnt' +DEBUG: DepthCamera: Setting parameter 'dlycntsf' +INFO: CameraSystem: Successfully refreshed parameters for SonyCDKCamera(0::04b4:9109::). addItem prifle id : 130 + d.getCurrentCameraProfileID() : 130 + mode_list setCurrentIndex === 0 : + mode_list text Normal + +CalibrationStatus: Calibration invalid for - Pixelwise Phase Offset, Common Phase Offset, Temperature. + +DEBUG: VoxelProgrammerBase: register write @0x69 = 1 +DEBUG: table @0 = 0, 1 +DEBUG: table @1 = 0.707107, 0.707107 +DEBUG: table @2 = 1, 6.12323e-17 +DEBUG: table @3 = 0.707107, -0.707107 +DEBUG: table @4 = 1.22465e-16, -1 +DEBUG: table @5 = -0.707107, -0.707107 +DEBUG: table @6 = -1, -1.83697e-16 +DEBUG: table @7 = -0.707107, 0.707107 +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: ToFSonyFrameGenerator:setParameters pixelwise enable:1 phaseOffsetFileName:SonyCDKCamera70cm8phase60mhzPhaseOffset.bin data size:307203 +DEBUG: table @0 = 0, 1 +DEBUG: table @1 = 0.707107, 0.707107 +DEBUG: table @2 = 1, 6.12323e-17 +DEBUG: table @3 = 0.707107, -0.707107 +DEBUG: table @4 = 1.22465e-16, -1 +DEBUG: table @5 = -0.707107, -0.707107 +DEBUG: table @6 = -1, -1.83697e-16 +DEBUG: table @7 = -0.707107, 0.707107 +DEBUG: ToFSonyCamera: Starting with 640x480@6fps end of init + +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338820 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638305136367 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638305287393 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638305439451 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638305591410 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638305743398 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638305895457 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338553 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638306048683 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638306206675 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337890 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638306351306 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638306503350 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638306656452 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338844 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638306808401 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638306960330 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638307112505 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638307264340 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638307416417 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338541 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638307568357 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338529 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638307720407 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638307872401 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638308025444 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638308177455 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638308329703 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338889 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638308481557 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638308633295 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638308785379 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638308937461 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338478 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638309089437 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338550 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638309241551 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638309394535 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638309546663 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638309698413 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638309850645 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638310003615 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638310154842 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638310306332 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638310458608 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338499 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638310610447 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337704 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638310762361 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638310914352 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638311066464 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638311219658 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638311371471 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638311523407 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638311675314 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638311828730 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638311979359 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338526 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638312131286 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338466 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638312283304 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638312435402 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638312588415 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638312739398 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638312892364 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338817 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638313044404 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638313196329 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638313348263 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638313500295 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338382 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638313652352 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338307 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638313804282 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638313956288 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638314108329 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638314260343 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638314412387 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638314565395 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638314717389 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638314869568 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638315021638 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338565 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638315173375 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337581 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638315325335 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338850 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638315478311 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638315629301 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638315782302 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338874 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638315934396 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638316086330 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:336972 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638316238282 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338883 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638316390250 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638316542482 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338634 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638316695219 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338418 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638316846366 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:336972 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638316999141 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638317151264 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338892 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638317303296 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338850 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638317455331 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:338664 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638317607309 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae not correct frame_size:461196 validFrames:0 invalidPhases:1 return lens:337932 +WARNING: USBBulkPhasesStreamer: Resetting bulk endpoint at 1552638317759415 validFrames:0 +ERROR: USBBulkPhasesStreamer frmae no all in one setStatusBar +DEBUG: Get USB device vid:1204 pid:37129 serail: +DEBUG: Get USB device vid:3034 pid:1041 serail: +DEBUG: Get USB device vid:3034 pid:21521 serail: +DEBUG: Get USB device vid:1452 pid:33417 serail: +DEBUG: Get USB device vid:2652 pid:17664 serail: +DEBUG: Get USB device vid:1452 pid:601 serail: +DEBUG: Get USB device vid:1452 pid:32775 serail: +INFO: CameraSystem:: interface id 0,device id 04b4:9109,id=0::04b4:9109:: +DEBUG: SonyCDKCameraFactory: new Sony camera 0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +WARNING: USBIO: error claim interfaceAccess denied (insufficient permissions) channel id 0 +DEBUG: USBIO: Init device0::04b4:9109:: +DEBUG: Configuration: try load dynamic library(pointcloud.so) path:/Users/hanyu/libPointCloud/libs/macos/lib/ +DEBUG: /Users/hanyu/libPointCloud/libs/macos/lib//../share/pointcloud-1.0.0/confDEBUG: +INFO: ParameterDMLParser: Found register map with name 'SonyIMX556' (v1.0) +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '2580' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '2580' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '82240' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '82240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7690' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '7730' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84480' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84480' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '84481' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '84481' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20600' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20600' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '20610' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '20610' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20580' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '20880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41100' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41110' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41120' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52850' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51710' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51710' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '53070' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '53070' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '51200' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '51200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51230' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51720' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51740' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51760' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51780' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51820' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51860' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51940' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '51980' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '52060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86600' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84560' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164050' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '164060' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86480' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86490' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86500' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86510' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86520' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86530' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86540' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86550' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86280' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86281' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86290' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86291' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86300' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86301' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86310' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86311' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84800' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84840' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84880' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84920' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '84960' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85000' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '85080' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86160' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86161' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86162' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86163' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86170' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86171' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86172' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86173' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86201' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86202' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86203' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86211' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86212' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86213' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86240' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86241' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86242' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86243' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86250' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86251' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86252' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86253' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41020' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41030' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41620' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41660' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41680' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41700' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '41710' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '86390' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82200' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '82220' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40960' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40960' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '40970' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '40970' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '112770' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120370' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '120380' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '124010' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43040' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43070' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '43090' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211210' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '211250' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100001' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100002' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100003' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100003' +DEBUG: ParameterDMLParser: Found a boolean parameter with id = '100004' which does not have valueList +DEBUG: ParameterDMLParser: Adding boolean parameter with id = '100004' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100005' +DEBUG: ParameterDMLParser: Adding int parameter with id = '100006' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100007' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100008' +DEBUG: ParameterDMLParser: Adding unsigned int parameter with id = '100009' +DEBUG: ParameterDMLParser: Adding int parameter with id = '200001' +DEBUG: Paramete \ No newline at end of file diff --git a/libs/macos/lib/plugin/libSonycdk.dylib b/libs/macos/lib/plugin/libSonycdk.dylib new file mode 100755 index 0000000..4384ee7 Binary files /dev/null and b/libs/macos/lib/plugin/libSonycdk.dylib differ diff --git a/libs/macos/lib/plugin/libcalculuscdk.0.6.7.dylib b/libs/macos/lib/plugin/libcalculuscdk.0.6.7.dylib new file mode 100755 index 0000000..3c05445 Binary files /dev/null and b/libs/macos/lib/plugin/libcalculuscdk.0.6.7.dylib differ diff --git a/libs/macos/lib/plugin/libcalculuscdk.34.dylib b/libs/macos/lib/plugin/libcalculuscdk.34.dylib new file mode 120000 index 0000000..e83af0e --- /dev/null +++ b/libs/macos/lib/plugin/libcalculuscdk.34.dylib @@ -0,0 +1 @@ +libcalculuscdk.0.6.7.dylib \ No newline at end of file diff --git a/libs/macos/lib/plugin/libcalculuscdk.dylib b/libs/macos/lib/plugin/libcalculuscdk.dylib new file mode 120000 index 0000000..db49f17 --- /dev/null +++ b/libs/macos/lib/plugin/libcalculuscdk.dylib @@ -0,0 +1 @@ +libcalculuscdk.34.dylib \ No newline at end of file diff --git a/libs/macos/lib/plugin/libtintincdk.0.6.7.dylib b/libs/macos/lib/plugin/libtintincdk.0.6.7.dylib new file mode 100755 index 0000000..5b7dc80 Binary files /dev/null and b/libs/macos/lib/plugin/libtintincdk.0.6.7.dylib differ diff --git a/libs/macos/lib/plugin/libtintincdk.34.dylib b/libs/macos/lib/plugin/libtintincdk.34.dylib new file mode 120000 index 0000000..2f43e24 --- /dev/null +++ b/libs/macos/lib/plugin/libtintincdk.34.dylib @@ -0,0 +1 @@ +libtintincdk.0.6.7.dylib \ No newline at end of file diff --git a/libs/macos/lib/plugin/libtintincdk.dylib b/libs/macos/lib/plugin/libtintincdk.dylib new file mode 120000 index 0000000..20307e7 --- /dev/null +++ b/libs/macos/lib/plugin/libtintincdk.dylib @@ -0,0 +1 @@ +libtintincdk.34.dylib \ No newline at end of file diff --git a/libs/macos/lib/python2.7/PointCloud.py b/libs/macos/lib/python2.7/PointCloud.py new file mode 100644 index 0000000..4f5ba55 --- /dev/null +++ b/libs/macos/lib/python2.7/PointCloud.py @@ -0,0 +1,224 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 3.0.12 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + +from sys import version_info as _swig_python_version_info +if _swig_python_version_info >= (2, 7, 0): + def swig_import_helper(): + import importlib + pkg = __name__.rpartition('.')[0] + mname = '.'.join((pkg, '_PointCloud')).lstrip('.') + try: + return importlib.import_module(mname) + except ImportError: + return importlib.import_module('_PointCloud') + _PointCloud = swig_import_helper() + del swig_import_helper +elif _swig_python_version_info >= (2, 6, 0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_PointCloud', [dirname(__file__)]) + except ImportError: + import _PointCloud + return _PointCloud + try: + _mod = imp.load_module('_PointCloud', fp, pathname, description) + finally: + if fp is not None: + fp.close() + return _mod + _PointCloud = swig_import_helper() + del swig_import_helper +else: + import _PointCloud +# pull in all the attributes from _PointCloud +if __name__.rpartition('.')[0] != '': + if _swig_python_version_info >= (2, 7, 0): + try: + from ._PointCloud import * + except ImportError: + from _PointCloud import * + else: + from _PointCloud import * +else: + from _PointCloud import * +del _swig_python_version_info + +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. + +try: + import builtins as __builtin__ +except ImportError: + import __builtin__ + +def _swig_setattr_nondynamic(self, class_type, name, value, static=1): + if (name == "thisown"): + return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name, None) + if method: + return method(self, value) + if (not static): + if _newclass: + object.__setattr__(self, name, value) + else: + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + + +def _swig_setattr(self, class_type, name, value): + return _swig_setattr_nondynamic(self, class_type, name, value, 0) + + +def _swig_getattr(self, class_type, name): + if (name == "thisown"): + return self.this.own() + method = class_type.__swig_getmethods__.get(name, None) + if method: + return method(self) + raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) + + +def _swig_repr(self): + try: + strthis = "proxy of " + self.this.__repr__() + except __builtin__.Exception: + strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except __builtin__.Exception: + class _object: + pass + _newclass = 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# This file is compatible with both classic and new-style classes. + + diff --git a/libs/macos/lib/python2.7/PointCloud.pyc b/libs/macos/lib/python2.7/PointCloud.pyc new file mode 100644 index 0000000..bbb6bff Binary files /dev/null and b/libs/macos/lib/python2.7/PointCloud.pyc differ diff --git a/libs/macos/lib/python2.7/_PointCloud.so b/libs/macos/lib/python2.7/_PointCloud.so new file mode 100755 index 0000000..99b77fa Binary files /dev/null and b/libs/macos/lib/python2.7/_PointCloud.so differ diff --git a/libs/macos/share/pointcloud-1.0.0/conf/SONY556IMX.dml b/libs/macos/share/pointcloud-1.0.0/conf/SONY556IMX.dml new file mode 100644 index 0000000..265e3f0 --- /dev/null +++ b/libs/macos/share/pointcloud-1.0.0/conf/SONY556IMX.dml @@ -0,0 +1,1221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+
+ + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
diff --git a/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera.conf b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera.conf new file mode 100644 index 0000000..9d0ff0e --- /dev/null +++ b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera.conf @@ -0,0 +1,8 @@ +[core] +dml = SONY556IMX.dml +camera_profiles = SonyCDKCameraNormal.conf +default_profile = 130 + +[observed_params] +tsensor = refresh:5 +tillum = refresh:5 \ No newline at end of file diff --git a/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera70cm8phase60mhzPhaseOffset.bin b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera70cm8phase60mhzPhaseOffset.bin new file mode 100644 index 0000000..668d26b Binary files /dev/null and b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera70cm8phase60mhzPhaseOffset.bin differ diff --git a/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera8phase80cm60mhzPhaseOffset.bin b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera8phase80cm60mhzPhaseOffset.bin new file mode 100644 index 0000000..88923ac Binary files /dev/null and b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCamera8phase80cm60mhzPhaseOffset.bin differ diff --git a/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCameraNormal.conf b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCameraNormal.conf new file mode 100644 index 0000000..e092c44 --- /dev/null +++ b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCameraNormal.conf @@ -0,0 +1,74 @@ +[global] +id = 130 +name = Normal + +[defining_params] +#make sure to send this register at first after power-on = inck frequency[mhz] +unambiguous_range = 4.96 #7.45 +intg_time = 100 #100 +mod_freq1 = 60 +sub_rseq_lnum = 40 #40 #3 + +[params] +#mode setting +rngchken = 0 +dutof_mode = 0 #4 +hmax = 1800 #1900 #1388 #1700 #2304 +micr_lnum = 10000 #10000 #2500 +dpth_su_num = 30 +binning_mode = 0 #3 +phases_num = 8 +#sub_fnum = 8 #4 +#gdphs0 = 0 +#gdphs1 = 2 +#gdphs2 = 4 +#gdphs3 = 6 +#gdphs0 = 0 +#gdphs1 = 1 +#gdphs2 = 2 +#gdphs3 = 3 +#gdphs4 = 4 +#gdphs5 = 5 +#gdphs6 = 6 +#gdphs7 = 7 + +#exarea_intg_00 = 96000 +#exarea_intg_01 = 96000 +#exarea_intg_02 = 96000 +#exarea_intg_03 = 96000 +#exarea_intg_04 = 96000 +#exarea_intg_05 = 96000 +#exarea_intg_06 = 96000 +#exarea_intg_07 = 96000 +dlycnt = 5 +anadlycnt = 14 #40 +dlycntsf = 0 # 10 + +[calib] +fy = 478 #59.75 #478 #247.0 +fx = 478 #59.75 #478 #247.0 +cx = 319 #39.875 #319.0 +cy = 239 #29.8 #239.0 +k1 = -0.0 +k2 = -0.0 +k3 = 0.00 +p1 = 0.00 +p2 = 0.00 +calib_disable = 14 #78 +actual_distance = 0.8 +tsensor_calib = 51 #60 +tillum_calib = 0 +phase_corr_2 = 0 +phase_corr_1 = 36 #16 #69 #-194 +disable_offset_corr = 0 #0 +phasecorrection = file:SonyCDKCamera8phase80cm60mhzPhaseOffset.bin +#SonyCDKCameranew8phase70cm60mhzPhaseOffset.bin + +#freq_corr = 1 +#freq_corr_at = 36 +#phase_lin_coeff = 15 132 246 364 491 654 777 912 1039 +#phase_lin_corr_period = 0 +disable_temp_corr = 0 +coeff_illum = 0 +coeff_sensor = 9 +calib_prec = 1 \ No newline at end of file diff --git a/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCameranew8phase70cm60mhzPhaseOffset.bin b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCameranew8phase70cm60mhzPhaseOffset.bin new file mode 100644 index 0000000..2038154 Binary files /dev/null and b/libs/macos/share/pointcloud-1.0.0/conf/SonyCDKCameranew8phase70cm60mhzPhaseOffset.bin differ diff --git a/libs/ubuntu/README.md b/libs/ubuntu/README.md new file mode 100644 index 0000000..e69de29 diff --git a/libs/ubuntu/include/pointcloud-1.0.0/CameraSystem.h b/libs/ubuntu/include/pointcloud-1.0.0/CameraSystem.h new file mode 100644 index 0000000..617ab96 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/CameraSystem.h @@ -0,0 +1,62 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_CAMERASYSTEM_H +#define POINTCLOUD_CAMERASYSTEM_H + +#include +#include + +namespace PointCloud +{ +class POINTCLOUD_EXPORT DepthCameraLibrary; +class POINTCLOUD_EXPORT DepthCameraFactory; +typedef Ptr DepthCameraLibraryPtr; +typedef Ptr DepthCameraFactoryPtr; +/** + * \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 POINTCLOUD_EXPORT CameraSystem +{ +public: + CameraSystem(); + virtual ~CameraSystem(); + Vector scan(); + DepthCameraPtr connect(const DevicePtr &device); + bool disconnect(const DepthCameraPtr &depthCamera, bool reset = false); + bool addDepthCameraFactory(DepthCameraFactoryPtr factory); + bool addFilterFactory(FilterFactoryPtr filterFactory); + Vector getSupportedFilters(); + bool getFilterDescription(const String &filterName, FilterDescription &description); + FilterPtr createFilter(const String &name, DepthCamera::FrameType type); + bool getFrameGenerator(uint8_t frameType, GeneratorIDType generatorID, FrameGeneratorPtr &frameGenerator); + //Vector getProgrammableDevices(); + //bool addDownloaderFactory(DownloaderFactoryPtr downloaderFactory); + //DownloaderPtr getDownloader(const DevicePtr &device); +protected: + void _init(); + void _loadLibraries(const Vector &paths); +protected: + Vector _libraries; + Map _factories; // Key = device ID as returned by Device::id() + Map _depthCameras; // Key = device ID as returned by Device::id() + Map _filterFactories; // Key = filter name + //Map _downloaderFactories;// Key = device ID as returned by Device::id() + Map _factoryForGeneratorID; // Key = frame generator ID +}; + +} + +#endif // POINTCLOUD_CAMERASYSTEM_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Common.h b/libs/ubuntu/include/pointcloud-1.0.0/Common.h new file mode 100644 index 0000000..0f5d09e --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Common.h @@ -0,0 +1,207 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_COMMON_H +#define POINTCLOUD_COMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include + +#include +#include + +#include "PointCloudConfig.h" +#include "PointCloudExports.h" + +#if defined(_WIN32) || defined(APPLE) || defined(ANDROID) +typedef uint32_t uint; +#else +typedef unsigned int uint; +#endif + +namespace PointCloud +{ + +/** + * \defgroup Util Common and Utility classes + * @{ + */ + +#ifndef SWIG +template +using Vector = std::vector; + +template +using List = std::list; + +template +using Set = std::set; + +template +using Map = std::unordered_map; + +template +using Function = std::function; + +template +using Atomic = std::atomic; + +template +using Lock = std::unique_lock; + +template +using shared_ptr = Ptr; +#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 Complex; +typedef std::complex ComplexDouble; + +typedef std::thread Thread; +typedef Ptr 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 POINTCLOUD_EXPORT getHex(uint16_t value); +void POINTCLOUD_EXPORT split(const String &str, const char delimiter, Vector &split); +void POINTCLOUD_EXPORT breakLines(const String &str, std::ostream &out, const uint maxPerLine, const String &newlinePrefix); + +/// Array handling template +template +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 +Ptr byteAlloc(unsigned long sizeInBytes) +{ + return Ptr((T *)new uint8_t[sizeInBytes], [](T *d) { delete[]((uint8_t *)d); }); +} + +uint POINTCLOUD_EXPORT gcd(uint n, uint m); + +// This returns nearest 'n = 2^m' such that 2^(m - 1) < value < 2^m +unsigned int POINTCLOUD_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(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(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 POINTCLOUD_EXPORT getFiles(const String &dir, const String &matchString, Vector &files); + +bool POINTCLOUD_EXPORT isFilePresent(const String &filename); +bool POINTCLOUD_EXPORT isDirectory(const String &filename); +bool POINTCLOUD_EXPORT makeDirectory(const String &filename); +String POINTCLOUD_EXPORT dirname(const String &filename); +String POINTCLOUD_EXPORT basename(const String &filename); + +String POINTCLOUD_EXPORT substitute(const String &s, const Vector &keys, const Vector &values); + +/** + * @} + */ + +} + +#endif //POINTCLOUD_COMMON_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Configuration.h b/libs/ubuntu/include/pointcloud-1.0.0/Configuration.h new file mode 100644 index 0000000..07466bc --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Configuration.h @@ -0,0 +1,506 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_CONFIGURATION_H +#define POINTCLOUD_CONFIGURATION_H + +#include "Common.h" +#include "DataPacket.h" +//#include "HardwareSerializer.h" + +#define FILE_PREFIX "file:" + +#define CALIB_DISABLE "calib_disable" + +namespace PointCloud +{ + +/** + * \ingroup Util + */ + +struct SDKVersion +{ + uint8_t major, minor, patch, abi, conf; +}; + +class POINTCLOUD_EXPORT Configuration +{ +protected: + struct _Path + { + String installPath; + String environmentVariable; + }; + + String _sdkPath; + String _sdkVersion; + + Vector _pathKeys; + Vector _pathValues; + + static const Map _pathTypes; + + bool _getPaths(const String &type, Vector &paths); + + bool _get(const String &type, String &name); + + static bool _addPath(const String &type, const String &path); + +public: + static SDKVersion getSDKVersion(); + + Configuration(); + + inline bool getFirmwarePaths(Vector &paths) { return _getPaths("fw", paths); } + inline bool getConfPaths(Vector &paths) { return _getPaths("conf", paths); } + inline bool getLibPaths(Vector &paths) { return _getPaths("lib", paths); } + + inline static bool addFirmwarePath(const String &path) { return _addPath("fw", path); } + inline static bool addConfPath(const String &path) { return _addPath("conf", path); } + inline static bool addLibPath(const String &path) { return _addPath("lib", path); } + static bool addPathToEnvironmentVariable(const String &environmentVariable, const String &path, bool prepend = true); + + inline static bool getEnvironmentVariable(const String &environmentVariable, String &value) + { + char *p = getenv(environmentVariable.c_str()); + if(p) { value = p; return true; } + return false; + } + + static bool setEnvironmentVariable(const String &environmentVariable, const String &value); + + inline static bool setSDKPath(const String &path) { return setEnvironmentVariable("POINTCLOUD_SDK_PATH", path); } + inline static bool getSDKPath(String &path) { return getEnvironmentVariable("POINTCLOUD_SDK_PATH", path); } + + bool getLocalPath(const String &type, String &path); + inline bool getLocalFirmwarePath(String &path) { return getLocalPath("fw", path); } + inline bool getLocalConfPath(String &path) { return getLocalPath("conf", path); } + inline bool getLocalLibPath(String &path) { return getLocalPath("lib", path); } + + bool getLocalFile(const String &type, String &fileName); + inline bool getLocalFirmwareFile(String &fileName) { return getLocalFile("fw", fileName); } + inline bool getLocalConfFile(String &fileName) { return getLocalFile("conf", fileName); } + inline bool getLocalLibFile(String &fileName) { return getLocalFile("lib", fileName); } + + /// Updates "name" to full path + inline bool getConfFile(String &fileName) { return _get("conf", fileName); } + inline bool getFirmwareFile(String &fileName) { return _get("fw", fileName); } + inline bool geLibFile(String &fileName) { return _get("lib", fileName); } + +}; + +class ConfigurationFile; + +class POINTCLOUD_EXPORT ConfigSet +{ +protected: + bool _get(const String &name, String &value) const; + bool _set(const String &name, const String &value); + +public: + Map params; + Vector paramNames; + + bool remove(const String &name); + + bool isEmpty() { return params.size() == 0; } + + bool isPresent(const String &name) const; + String get(const String &name) const; + int getInteger(const String &name) const; + float getFloat(const String &name) const; + bool getBoolean(const String &name) const; + + bool set(const String &name, const String &value); + bool setInteger(const String &name, int value); + bool setFloat(const String &name, float value); + bool setBoolean(const String &name, bool value); + + friend class ConfigurationFile; +}; + +struct ConfigDataPacket: public DataPacket +{ + enum PacketType + { + PACKET_CONFIG = 0, + PACKET_2D_DATA_FILE = 1 + }; + + ConfigDataPacket(): DataPacket() {} +}; + +class MainConfigurationFile; + +class POINTCLOUD_EXPORT ConfigurationFile +{ +protected: + bool _get(const String §ion, const String &name, String &value) const; + bool _set(const String §ion, const String &name, const String &value); + + String _fileName; + + Map> _dataFiles; + + MainConfigurationFile *_mainConfigurationFile; + + int _id, _parentID; + String _profileName; + + mutable Mutex _mutex; + + bool _serializeAllDataFiles(OutputStream &out); + bool _saveAllDataFiles(const String &prefix); + + template + bool _getData(const String &fileName, Vector &data); + + template + bool _setData(const String &fileName, const Vector &data); + + bool _copyFromParentIfNotPresent(ConfigurationFile *other, bool recurse = true); + +public: + typedef Map ConfigSetMap; + + enum Location + { + IN_HOST = 0, + IN_CAMERA = 1 + }; + +protected: + Location _location; + +public: + ConfigSetMap configs; + + inline Location getLocation() const { return _location; } + inline int getID() const { return _id; } + inline int getParentID() const { return _parentID; } + inline const String &getProfileName() const { return _profileName; } + + virtual bool isPresent(const String §ion, const String &name, bool includeParent = true) const; + virtual String get(const String §ion, const String &name) const; + + inline void setProfileName(const String &name) { _profileName = name; set("global", "name", name); } + inline void setID(const int id) { _id = id; setInteger("global", "id", id); } + inline void setParentID(const int id) { _parentID = id; setInteger("global", "parent", id); } + + template + bool getFile(const String §ion, const String &name, String &fileName, Vector &data); + + int getInteger(const String §ion, const String &name) const; + float getFloat(const String §ion, const String &name) const; + bool getBoolean(const String §ion, const String &name) const; + + virtual bool set(const String §ion, const String &name, const String &value); + + template + bool setFile(const String §ion, const String &name, const String &fileName, const Vector &data); + + bool setInteger(const String §ion, const String &name, int value); + bool setFloat(const String §ion, const String &name, float value); + bool setBoolean(const String §ion, const String &name, bool value); + + bool remove(const String §ion, const String &name); + bool removeSection(const String §ion); + + virtual bool getConfigSet(const String §ion, const ConfigSet *&configSet, bool includeParent = true) const; + + virtual bool read(const String &configFile); + virtual bool read(InputStream &in); + + virtual bool write(const String &configFile = ""); + virtual bool write(OutputStream &out); + + bool isValidCameraProfile(); + + virtual bool removeFile(); + + inline void clear() { Lock _(_mutex); configs.clear(); } + + inline const String &getConfigFileName() { return _fileName; } + + ConfigurationFile(): ConfigurationFile(0) {} + ConfigurationFile(MainConfigurationFile *mainConfigurationFile): + _mainConfigurationFile(mainConfigurationFile), _id(-1), _parentID(-1), _location(IN_HOST) {} + + ConfigurationFile(const ConfigurationFile &other) + { + operator =(other); + } + + inline ConfigurationFile &operator =(const ConfigurationFile &other) + { + configs = other.configs; + _fileName = other._fileName; + _mainConfigurationFile = other._mainConfigurationFile; + _id = other._id; + _profileName = other._profileName; + _parentID = other._parentID; + _location = other._location; + _dataFiles = other._dataFiles; + return *this; + } + + inline bool mergeParentConfiguration() + { + return _copyFromParentIfNotPresent(this); + } + + inline ConfigurationFile ©(const ConfigurationFile &other) + { + return operator =(other); + } + + virtual ~ConfigurationFile() {} + + friend class MainConfigurationFile; +}; + +template +bool ConfigurationFile::getFile(const String §ion, const String &name, String &fileName, Vector &data) +{ + String v = get(section, name); + + if(v.compare(0, sizeof(FILE_PREFIX) - 1, FILE_PREFIX) != 0 || v.size() <= sizeof(FILE_PREFIX) - 1) + { + logger(LOG_ERROR) << "ConfigurationFile: section = " << section << ", name = " << name << ", is not a file type." << std::endl; + return false; + } + + fileName = v.substr(sizeof(FILE_PREFIX) - 1); + + return _getData(fileName, data); +} + +template +bool ConfigurationFile::setFile(const String §ion, const String &name, const String &fileName, const Vector &data) +{ + return _setData(fileName, data) && set(section, name, "file:" + fileName); +} + +template +bool ConfigurationFile::_setData(const String &fileName, const Vector &data) +{ + Configuration c; + + String f = fileName; + if(!c.getLocalConfFile(f)) + { + logger(LOG_ERROR) << "ConfigurationFile: Failed to locate file '" << fileName << "'" << std::endl; + return false; + } + + OutputFileStream fs(f, std::ios::out | std::ios::binary); + + if(!fs.good()) + { + logger(LOG_ERROR) << "ConfigurationFile: Could not open file '" << fileName << "'" << std::endl; + return false; + } + + fs.write((const char *)data.data(), data.size()*sizeof(T)); + + fs.close(); + + _dataFiles[fileName].resize(data.size()*sizeof(T)); + + memcpy(_dataFiles[fileName].data(), data.data(), data.size()*sizeof(T)); + + return true; +} + +struct CalibrationInformation +{ + String name; + int id; + Vector definingParameters; + Vector calibrationParameters; +}; + +class POINTCLOUD_EXPORT MainConfigurationFile: public ConfigurationFile +{ +protected: + Map _cameraProfiles; + Map _cameraProfileNames; + int _defaultCameraProfileID, _defaultCameraProfileIDInHardware; + int _currentCameraProfileID; + ConfigurationFile *_currentCameraProfile; + + bool _updateCameraProfileList(); + + String _mainConfigName, _hardwareID; + + int _getNewCameraProfileID(bool inHost = true); + + bool _saveHardwareImage(Version &version, TimeStampType ×tamp, SerializedObject &so); + + //HardwareSerializerPtr _hardwareSerializer; + + int _quantizationFactor; + + Map _calibrationInformation; + + bool _removeCameraProfile(const int id, bool updateHardware = true); + bool _saveCameraProfileToHardware(int &id, Vector &newIDsAdded, Vector &oldIDsModified, bool saveParents = false, bool updateHardware = true, bool setAsDefault = false, const String &namePrefix = ""); + bool _rollbackCameraProfiles(const Vector &newIDsAdded, const Vector &oldIDsModified); + +public: + MainConfigurationFile(const String &name, const String &hardwareID, int quantizationFactor = 4/*, HardwareSerializerPtr hardwareSerializer = nullptr*/): + _currentCameraProfile(nullptr), _defaultCameraProfileID(-1), _defaultCameraProfileIDInHardware(-1), _mainConfigName(name), /*_hardwareSerializer(hardwareSerializer),*/ + _quantizationFactor(quantizationFactor) + { + //if(!hardwareSerializer) + // _hardwareSerializer = HardwareSerializerPtr(new HardwareSerializer()); + } + + void setSerializationQuantizationFactor(int quantizationFactor) { _quantizationFactor = quantizationFactor; } + + virtual bool read(const String &configFile); + + bool readFromHardware(); + bool writeToHardware(); + + inline bool hasHardwareConfigurationSupport() { return false; + //_hardwareSerializer && *_hardwareSerializer; + } + + //inline void setHardwareConfigSerializer(const HardwareSerializerPtr &hardwareSerializer) { _hardwareSerializer = hardwareSerializer; } + + virtual String get(const String §ion, const String &name) const; + virtual bool isPresent(const String §ion, const String &name, bool includeParent = true) const; + + int addCameraProfile(const String &profileName, const int parentID = -1); + bool setCurrentCameraProfile(const int id); + bool removeAllHardwareCameraProfiles(); + bool removeCameraProfile(const int id); + bool saveCameraProfileToHardware(int &id, bool saveParents = false, bool setAsDefault = false, const String &namePrefix = ""); + + ConfigurationFile *getDefaultCameraProfile(); + ConfigurationFile *getCameraProfile(const int id); + + template + bool getFile(const String §ion, const String &name, String &fileName, Vector &data); + + inline int getDefaultCameraProfileID() + { + if(_defaultCameraProfileIDInHardware >= 0) + return _defaultCameraProfileIDInHardware; + else + return _defaultCameraProfileID; + } + + inline int getDefaultCameraProfileIDInHost() + { + return _defaultCameraProfileID; + } + + inline int getDefaultCameraProfileIDInCamera() + { + return _defaultCameraProfileIDInHardware; + } + + /// This only removes the default ID from hardware and not the profile itself + bool removeDefaultCameraProfileIDInCamera(); + + bool setDefaultCameraProfile(const int id); + + inline void setHardwareID(const String &hwID) { _hardwareID = hwID; } + + inline int getCurrentProfileID() { return _currentCameraProfileID; } + + bool getCameraProfileName(const int id, String &cameraProfileName); + + inline const Map &getCameraProfileNames() { return _cameraProfileNames; } + + inline const Map &getCalibrationInformation() const { return _calibrationInformation; } + + virtual ~MainConfigurationFile() {} + + friend class ConfigurationFile; + friend class DepthCamera; +}; + +template +bool ConfigurationFile::_getData(const String &fileName, Vector &data) +{ + bool loadFromFile = false; + if(_dataFiles.find(fileName) == _dataFiles.end()) + { + if(_mainConfigurationFile && _parentID >= 0) + { + ConfigurationFile *parentConfig = _mainConfigurationFile->getCameraProfile(_parentID); + + // TODO This does not handle circular references between profiles + if(parentConfig && parentConfig->_getData(fileName, data)) + return true; + else + loadFromFile = true; + } + else + loadFromFile = true; + } + + if(loadFromFile) + { + Configuration c; + + String f = fileName; + if(!c.getConfFile(f)) + { + logger(LOG_ERROR) << "ConfigurationFile: Could not locate file '" << fileName << "'" << std::endl; + return false; + } + + InputFileStream fs(f, std::ios::in | std::ios::binary | std::ios::ate); + + if(!fs.good()) + { + logger(LOG_ERROR) << "ConfigurationFile: Could not open file '" << fileName << "'" << std::endl; + return false; + } + + int size = fs.tellg(); + + if(size == 0) + { + logger(LOG_ERROR) << "ConfigurationFile: Null config data '" << f << "'" << std::endl; + return false; + } + + Vector &d = _dataFiles[fileName]; + + d.resize(size); + fs.seekg(std::ios::beg); + fs.clear(); + fs.read((char *)d.data(), size); + } + + Vector &d = _dataFiles[fileName]; + + data.resize((d.size() + sizeof(T)/2)/sizeof(T)); + + memcpy(data.data(), d.data(), d.size()); + + return true; +} + +template +bool MainConfigurationFile::getFile(const String §ion, const String &name, String &fileName, Vector &data) +{ + if(!_currentCameraProfile || !_currentCameraProfile->getFile(section, name, fileName, data)) + return ConfigurationFile::getFile(section, name, fileName, data); + else + return true; +} + + +} + +#endif // CONFIGURATION_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/DataPacket.h b/libs/ubuntu/include/pointcloud-1.0.0/DataPacket.h new file mode 100644 index 0000000..8acf3bc --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/DataPacket.h @@ -0,0 +1,46 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DATA_PACKET_H +#define POINTCLOUD_DATA_PACKET_H + +#include "Common.h" +#include "SerializedObject.h" + +#include "Logger.h" + +namespace PointCloud +{ + +struct POINTCLOUD_EXPORT DataPacket +{ + char magic[6]; // + + uint8_t type; // PacketType + + uint32_t size; + + SerializedObject object; + + DataPacket() { strcpy(magic, "PTAI"); } + + bool readHeader(SerializedObject &in); + bool readHeader(InputStream &in); + + bool read(SerializedObject &in); + bool read(InputStream &in); + + bool write(SerializedObject &out); + bool write(OutputStream &out); + + inline bool verifyMagic() { return magic[0] == 'V' && magic[1] == 'O' && magic[2] == 'X' && magic[3] == 'E' && magic[4] == 'L'; } +}; + + + +} + +#endif \ No newline at end of file diff --git a/libs/ubuntu/include/pointcloud-1.0.0/DepthCamera.h b/libs/ubuntu/include/pointcloud-1.0.0/DepthCamera.h new file mode 100644 index 0000000..9693552 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/DepthCamera.h @@ -0,0 +1,230 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DEPTHCAMERA_H +#define POINTCLOUD_DEPTHCAMERA_H + +#include +#include +#include "VideoMode.h" +#include +#include "FrameStream.h" +#include "Timer.h" +#include "Configuration.h" + +#define BULK_XFER_EXTRA_SIZE 255 +#define CALIB_SECT_LENS "lens" +#define CALIB_SECT_LENS_ID 0 +#define TSENSOR "tsensor" +#define TILLUM "tillum" + +namespace PointCloud +{ + class POINTCLOUD_EXPORT Streamer; + class POINTCLOUD_EXPORT Parameter; + class POINTCLOUD_EXPORT FrameGenerator; + class POINTCLOUD_EXPORT PointCloudFrameGenerator; + class POINTCLOUD_EXPORT RegisterProgrammer; + typedef Ptr StreamerPtr; + typedef Ptr ParameterPtr; + typedef Ptr RegisterProgrammerPtr; + typedef Ptr FrameGeneratorPtr; + typedef Ptr PointCloudFrameGeneratorPtr; + /** + * \ingroup CamSys + * + * \brief This is primary class which provides API for a depth camera. + * + * DepthCamera is an abstract class which needs to be derived and implemented + * for individual depth camera types. + */ + class POINTCLOUD_EXPORT DepthCamera + { + public: + enum FrameType + { + FRAME_RAW_FRAME_UNPROCESSED = 0, + FRAME_RAW_FRAME_PROCESSED = 1, + FRAME_DEPTH_FRAME = 2, + FRAME_XYZI_POINT_CLOUD_FRAME = 3, + FRAME_TYPE_COUNT = 4 // This is just used for number of callback types + }; + typedef Function CallbackType; + public: + DepthCamera(const String &name, const String &chipset, DevicePtr device); + virtual ~DepthCamera(); + virtual bool isInit() = 0; + virtual bool isInitialized() const; + inline bool isRunning() const { return _running; } + inline bool isPaused() const { return _isPaused; } + bool start(); + bool stop(); + void wait(); + bool reset(); + bool pause(); + bool resume(); + bool close(); + + virtual bool registerCallback(FrameType type, CallbackType f); + virtual bool clearAllCallbacks(); + virtual bool clearCallback(FrameType type); + + bool setFrameRate(const FrameRate &r); + bool getFrameRate(FrameRate &r) const; + bool setFrameSize(const FrameSize &s); + bool getFrameSize(FrameSize &s) const; + bool getMaximumFrameSize(FrameSize &s) const; + bool getMaximumFrameRate(FrameRate &frameRate, const FrameSize &forFrameSize) const; + bool getSupportedVideoModes(Vector &supportedVideoModes) const; + bool getMaximumVideoMode(VideoMode &videoMode) const; + + bool getROI(RegionOfInterest &roi); + bool setROI(const RegionOfInterest &roi); + bool allowedROI(String &message); + + bool getFieldOfView(float &fovHalfAngle) const; + + virtual bool saveFrameStream(const String &fileName); + virtual bool isSavingFrameStream(); + virtual bool closeFrameStream(); + + template + bool get(const String &name, T &value, bool refresh = false) const; + template + bool set(const String &name, const T &value); + + inline const String &name() const { return _name; } + inline const String &id() const { return _id; } + inline const String &chipset() const { return _chipset; } + + virtual bool getSerialNumber(String &serialNumber) const; + virtual bool setSerialNumber(const String &serialNumber); + + inline const DevicePtr &getDevice() const { return _device; } + template + bool getStreamParam(const String &name, T &value) const; + bool refreshParams(); + + // WARNING: Avoid using get() and set() on ParameterPtr, obtained via getParam() or getParameters(). It is not thread-safe. Instead use get() and set() on DepthCamera + const ParameterPtr getParam(const String &name) const; + inline const Map &getParameters() const { return _parameters; } + + bool getBytesPerPixel(uint &bpp) const; + bool setBytesPerPixel(const uint &bpp); + bool getFrameGeneratorConfig(FrameType type, SerializedObject &object); + // beforeFilterIndex = -1 => at the end, otherwise at location before the given filter index. + // Return value: + // >= 0 => add successfully with return value as filter ID. + // -1 => failed to add filter + virtual int addFilter(FilterPtr p, FrameType frameType, int beforeFilterID = -1); + virtual FilterPtr getFilter(int filterID, FrameType frameType) const; + virtual bool removeFilter(int filterID, FrameType frameType); + virtual bool removeAllFilters(FrameType frameType); + virtual void resetFilters(); + + inline const FilterSet &getUnprocessedRawFilterSet() { return _unprocessedFilters; } + inline const FilterSet &getProcessedRawFilterSet() { return _processedFilters; } + inline const FilterSet &getDepthFilterSet() { return _depthFilters; } + + // RegisterProgrammer is usually thread-safe to use outside directly + inline RegisterProgrammerPtr getProgrammer() { return _programmer; } + // Streamer may not be thread-safe + inline StreamerPtr getStreamer() { return _streamer; } + + inline bool reloadConfiguration() { return configFile.read(_name + ".conf"); } + inline const Map &getCameraProfileNames() { return configFile.getCameraProfileNames(); } + inline int getCurrentCameraProfileID() { return configFile.getCurrentProfileID(); } + + int addCameraProfile(const String &profileName, const int parentID); + bool setCameraProfile(const int id, bool softApply = false); + bool removeCameraProfile(const int id); + /* + inline bool saveCameraProfileToHardware(int &id, bool saveParents = false, bool setAsDefault = false, const String &namePrefix = "") { return configFile.saveCameraProfileToHardware(id, saveParents, setAsDefault, namePrefix); } + */ + protected: + bool _addParameters(const Vector ¶ms); + // Callback the registered function for 'type' if present and decide whether continue processing or not + virtual bool _callbackAndContinue(uint32_t &callBackTypesToBeCalled, FrameType type, const Frame &frame); + + bool _init(); + virtual bool _start() = 0; + virtual bool _stop() = 0; + + virtual bool _captureRawUnprocessedFrame(RawFramePtr &rawFrame) = 0; + virtual bool _processRawFrame(const RawFramePtr &rawFrameInput, RawFramePtr &rawFrameOutput) = 0; // here output raw frame will have processed data, like ToF data for ToF cameras + virtual bool _convertToDepthFrame(const RawFramePtr &rawFrame, DepthFramePtr &depthFrame) = 0; + virtual bool _convertToPointCloudFrame(const DepthFramePtr &depthFrame, PointCloudFramePtr &pointCloudFrame); + + virtual void _captureLoop(); // the main capture loop + void _captureThreadWrapper(); // this is non-virtual and simply calls _captureLoop + bool _running, _isPaused; // is capture running? + bool _writeToFrameStream(RawFramePtr &rawUnprocessed); + + // These protected getters and setters are not thread-safe. These are to be directly called only when nested calls are to be done from getter/setter to another. + // Otherwise use the public functions + template + bool _get(const String &name, T &value, bool refresh = false) const; + template + bool _set(const String &name, const T &value); + + virtual bool _setFrameRate(const FrameRate &r) = 0; + virtual bool _getFrameRate(FrameRate &r) const = 0; + virtual bool _setFrameSize(const FrameSize &s) = 0; + virtual bool _getFrameSize(FrameSize &s) const = 0; + virtual bool _getMaximumFrameSize(FrameSize &s) const = 0; + virtual bool _getMaximumFrameRate(FrameRate &frameRate, const FrameSize &forFrameSize) const = 0; + virtual bool _getSupportedVideoModes(Vector &supportedVideoModes) const = 0; + virtual bool _getMaximumVideoMode(VideoMode &videoMode) const = 0; + + virtual bool _getBytesPerPixel(uint &bpp) const = 0; + virtual bool _setBytesPerPixel(const uint &bpp) = 0; + + virtual bool _getROI(RegionOfInterest &roi) const = 0; + virtual bool _setROI(const RegionOfInterest &roi) = 0; + virtual bool _allowedROI(String &message) = 0; + virtual bool _getFieldOfView(float &fovHalfAngle) const = 0; + inline void _makeID() { _id = _name + "(" + _device->id() + ")"; } + virtual bool _reset() = 0; + virtual bool _onReset() = 0; + virtual bool _applyConfigParams(const ConfigSet *params); + virtual bool _saveCurrentProfileID(const int id) = 0; + virtual bool _getCurrentProfileID(int &id) = 0; + inline Map &_getCalibrationInformationStructure() { return configFile._calibrationInformation; } + public: + MainConfigurationFile configFile; // This corresponds to camera specific configuration file + private: + mutable Mutex _accessMutex; // This is locked by getters and setters which are public + mutable Mutex _frameStreamWriterMutex; + protected: + DevicePtr _device; + String _name, _id, _chipset; + + Map _parameters; + RegisterProgrammerPtr _programmer; + StreamerPtr _streamer; + + FrameGeneratorPtr _frameGenerators[3]; + PointCloudFrameGeneratorPtr _pointCloudFrameGenerator; + bool _parameterInit; + + RawFramePtr _rawFrame; + FrameBufferManager _rawFrameBuffers; + FrameBufferManager _depthFrameBuffers; + FrameBufferManager _pointCloudBuffers; + + FilterSet _unprocessedFilters, _processedFilters; + FilterSet _depthFilters; + FrameStreamWriterPtr _frameStreamWriter; + + CallbackType _callback[FRAME_TYPE_COUNT]; + + uint32_t _callBackTypesRegistered = 0; + ThreadPtr _captureThread = 0; + }; + typedef Ptr DepthCameraPtr; +} + +#endif // DEPTHCAMERA_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Device.h b/libs/ubuntu/include/pointcloud-1.0.0/Device.h new file mode 100644 index 0000000..63eab76 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Device.h @@ -0,0 +1,127 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DEVICE_H +#define POINTCLOUD_DEVICE_H + +#include "Common.h" +#include + +namespace PointCloud +{ + +/** + * \addtogroup CamSys + * @{ + */ +class POINTCLOUD_EXPORT Device +{ +public: + enum Interface { + USB = 0, + LPT = 1, + SERIAL = 2, + I2C = 3 + }; +protected: + String _id; // in the format interface::device::serialnumber. "device" for USB devices is "vendorid:productid" + Interface _interfaceID; + String _deviceID; + String _serialNumber; + + String _serialIndex; + bool _showSerialIndex; + + String _description; + int _channelID; // Channel ID for multi-channel devices + + void _makeID() + { + std::ostringstream s; + s << _interfaceID << "::" << _deviceID << "::" << _serialNumber; + + if(_showSerialIndex) + s << ":" << _serialIndex; + + if(_channelID >= 0) + s << "::" << _channelID; + + _id = s.str(); + } + +public: + Device(Interface interfaceid, const String &deviceid, const String &serialnumber, int channelID = -1, const String &description = "", const String &serialIndex = "", bool showSerialIndex = false): _interfaceID(interfaceid), + _deviceID(deviceid), _serialNumber(serialnumber), _description(description), _channelID(channelID), _serialIndex(serialIndex), _showSerialIndex(showSerialIndex) + { + _makeID(); + } + + // Need to implement in all derived classes + virtual Vector> getDevices(const Vector &channels) const { return Vector>(); } + + inline const String &id() const { return _id; } + + inline Interface interfaceID() const { return _interfaceID; } + inline const String &deviceID() const { return _deviceID; } + inline const String &serialNumber() const { return _serialNumber; } + inline void setSerialNumber(const String &s) { _serialNumber = s; } + inline const String &serialIndex() const { return _serialIndex; } + inline void showSerialIndex() { _showSerialIndex = true; _makeID(); } + inline void dontShowSerialIndex() { _showSerialIndex = false; _makeID(); } + inline const int channelID() const { return _channelID; } + inline const String &description() const { return _description; } + virtual ~Device() {} +}; + +typedef Ptr DevicePtr; + +class POINTCLOUD_EXPORT USBDevice : public Device +{ + uint16_t _vendorID, _productID; +public: + USBDevice(uint16_t vendorid, uint16_t productid, const String &serialnumber, int channelID = -1, const String &description = "", const String &serialIndex = "", bool showSerialIndex = false): + Device(Device::USB, getHex(vendorid) + ":" + getHex(productid), serialnumber, channelID, description, serialIndex, showSerialIndex), _vendorID(vendorid), _productID(productid) {} +#ifdef ANDROID + USBDevice(uint16_t vendorid, uint16_t productid, const String &serialnumber, int usbfd,int channelID = -1, const String &description = "", const String &serialIndex = "", bool showSerialIndex = false): + Device(Device::USB, getHex(vendorid) + ":" + getHex(productid), serialnumber, channelID, description, serialIndex, showSerialIndex), _vendorID(vendorid), _productID(productid),usbFd(usbfd) {} +#endif + virtual Vector getDevices(const Vector &channels) const; + + inline uint16_t vendorID() const { return _vendorID; } + inline uint16_t productID() const { return _productID; } +#ifdef ANDROID + int usbFd; +#endif + + virtual ~USBDevice() {} +}; + +class POINTCLOUD_EXPORT DeviceScanner +{ +protected: + virtual Vector _scan() = 0; +public: + static Vector scan(); + + virtual ~DeviceScanner() {} +}; + +class POINTCLOUD_EXPORT USBDeviceScanner : public DeviceScanner +{ +protected: + virtual Vector _scan(); + friend class DeviceScanner; + + virtual ~USBDeviceScanner() {} +}; + +/** + * @} + */ + +} + +#endif // DEVICE_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/BilateralFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/BilateralFilter.h new file mode 100644 index 0000000..14692ac --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/BilateralFilter.h @@ -0,0 +1,52 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_BILATERAL_H +#define POINTCLOUD_BILATERAL_H + +#include "Filter.h" + +#include "DiscreteGaussian.h" + + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class BilateralFilter: public Filter +{ +protected: + DiscreteGaussian _discreteGuassian; + + FrameSize _size; + + virtual void _onSet(const FilterParameterPtr &f); + + template + bool _filter(const T *in, const T2 *ref, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + BilateralFilter(float sigma = 0.5); + virtual ~BilateralFilter() {} + + virtual void reset(); + + +}; + +/** + * @} + */ + +} + +#endif // POINTCLOUD_BILATERAL_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/DarkPixFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/DarkPixFilter.h new file mode 100644 index 0000000..0e47f22 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/DarkPixFilter.h @@ -0,0 +1,55 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DARKPIX_H +#define POINTCLOUD_DARKPIX_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT DarkPixFilter: public Filter +{ +protected: + float _aThrNear, _phThrNear; + float _aThrFar, _phThrFar; + float _ambThresh; + + Vector _current; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const T *in, T2 *amp, uint8_t *amb, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + DarkPixFilter(float aThrNear = 1, float phThrNear = 4095, float aThrFar = 20, float phThrFar = 2000, float ambThresh = 1); + + virtual void reset(); + + virtual ~DarkPixFilter() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_DARKPIX_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/DenoiseFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/DenoiseFilter.h new file mode 100644 index 0000000..5290ae0 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/DenoiseFilter.h @@ -0,0 +1,64 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DENOISE_H +#define POINTCLOUD_DENOISE_H + +#include "Filter.h" + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT DenoiseFilter: public Filter +{ +protected: + uint _order; + float _threshold; + + std::deque> _ampHistory; + std::deque> _phaseHistory; + std::deque> _ambHistory; + std::deque> _flagsHistory; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const FramePtr &in_p, FramePtr &out_p); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + DenoiseFilter(uint order = 3, float threshold = 30/*10000*/); + + virtual void reset(); + + virtual ~DenoiseFilter() {} + +// liudao add in 2017.06.13 +public: + Vector m_frameIn; + Vector m_frameOut; + +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_DENOISE_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/DiscreteGaussian.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/DiscreteGaussian.h new file mode 100644 index 0000000..0ab695c --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/DiscreteGaussian.h @@ -0,0 +1,71 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_DISCRETE_GUASSIAN_H +#define POINTCLOUD_DISCRETE_GUASSIAN_H + +#include "Common.h" + +#define _MATH_DEFINES +#include + + +namespace PointCloud +{ + +class POINTCLOUD_EXPORT DiscreteGaussian +{ + float _sigma, _squaredSigma; + + Vector _values; + + inline void _computeValues(); + +public: + DiscreteGaussian(float s) { setStandardDeviation(s); } + + inline void setStandardDeviation(float s) + { + _sigma = s; + _squaredSigma = _sigma*_sigma; + _computeValues(); + } + + inline float getStandardDeviation() const { return _sigma; } + inline float getSquaredStandardDeviation() const { return _squaredSigma; } + + inline float valueAt(int x) + { + int y = (x < 0)?-x:x; + + if(y >= _values.size()) + return 0.0f; + else + return _values[y]; + } +}; + +inline void DiscreteGaussian::_computeValues() +{ + int limit = sqrt(20)*_sigma + 1; // This would correspond to exp(-10) + + _values.resize(limit); + + if(!floatEquals(_sigma, 0)) + { + float d = _sigma*sqrt(2*M_PI); + + for(auto i = 0; i < limit; i++) + _values[i] = exp(-i*i/2.0f/_squaredSigma)/d; + } + else + _values[0] = 1; +} + + +} + +#endif diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/Filter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/Filter.h new file mode 100644 index 0000000..df4a37e --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/Filter.h @@ -0,0 +1,199 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FILTER_H +#define POINTCLOUD_FILTER_H + + +#include +//#include +#include +#include + +#include + +#include "PointCloudExports.h" + +namespace PointCloud +{ + +class DepthCamera; + +typedef Ptr DepthCameraPtr; + +/** + * \defgroup Flt Filter related classes + * @{ + */ + +class POINTCLOUD_EXPORT Filter +{ +protected: + String _name, _nameScope, _description; + String _id; + + inline void _makeID() + { + if(_nameScope.size()) + _id = _nameScope + "::" + _name; + else + _id = _name; + } + + mutable Mutex _accessMutex; + + DepthCameraPtr _depthCamera; + + Map _parameters; + + virtual bool _addParameters(const Vector ¶ms); + + virtual bool _prepareOutput(const FramePtr &in, FramePtr &out); + + // On setting of a parameter this is called + virtual void _onSet(const FilterParameterPtr &f) = 0; + + virtual bool _filter(const FramePtr &in, FramePtr &out) = 0; + + template + bool _get(const String &name, T &value); + + template + bool _set(const String &name, const T &value); + +public: + Filter(const String &name, const String &description = "", const String &nameScope = ""): _name(name), _nameScope(nameScope), _description(description) + { + _makeID(); + } + + inline void setDepthCamera(const DepthCameraPtr &d) + { + _depthCamera = d; + } + + inline const Map ¶meters() { return _parameters; } + + inline const String &name() { return _id; } + inline const String &description() { return _description; } + + inline void setNameScope(const String &scope) { _nameScope = scope; _makeID(); } + + inline bool filter(const FramePtr &in, FramePtr &out); + + virtual void reset() = 0; + + inline FilterParameterConstPtr getParam(const String &name) const; + + template + bool get(const String &name, T &value); + + template + bool set(const String &name, const T &value); + + + virtual ~Filter() {} +}; + +inline bool Filter::filter(const FramePtr &in, FramePtr &out) +{ + Lock _(_accessMutex); + return _filter(in, out); +} + + +FilterParameterConstPtr Filter::getParam(const String &name) const +{ + Lock _(_accessMutex); + + auto p = _parameters.find(name); + + if(p != _parameters.end()) + return std::const_pointer_cast(p->second); + else + return nullptr; +} + + +template +bool Filter::get(const String &name, T &value) +{ + Lock _(_accessMutex); + return _get(name, value); +} + +template +bool Filter::_get(const String &name, T &value) +{ + auto p = _parameters.find(name); + + if(p != _parameters.end()) + { + FilterParameterTemplate *f = dynamic_cast *>(p->second.get()); + + if(!f) + { + logger(LOG_ERROR) << "Filter: Invalid type '" << typeid(value).name() << "' to get parameter '" << name << "'" << std::endl; + return false; + } + + return f->get(value); + } + else + { + logger(LOG_ERROR) << "Filter: Unknown parameter name '" << name << "'" << std::endl; + return false; + } +} + +template +bool Filter::set(const String &name, const T &value) +{ + Lock _(_accessMutex); + return _set(name, value); +} + +template +bool Filter::_set(const String &name, const T &value) +{ + auto p = _parameters.find(name); + + if(p != _parameters.end()) + { + FilterParameterTemplate *f = dynamic_cast *>(p->second.get()); + + if(!f) + { + logger(LOG_ERROR) << "Filter: Invalid type '" << typeid(value).name() << "' to get parameter '" << name << "'" << std::endl; + return false; + } + + if(f->set(value)) + { + _onSet(p->second); + return true; + } + else + return false; + } + else + { + logger(LOG_ERROR) << "Filter: Unknown parameter name '" << name << "'" << std::endl; + return false; + } +} + +typedef Ptr FilterPtr; + +/** + * @} + */ + + +} + + +#endif //POINTCLOUD_FILTER_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterFactory.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterFactory.h new file mode 100644 index 0000000..c7e8eb4 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterFactory.h @@ -0,0 +1,78 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FILTER_FACTORY_H +#define POINTCLOUD_FILTER_FACTORY_H + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class FilterDescription +{ + typedef Function _CreateFilter; +protected: + _CreateFilter _createFilter; +public: + String name; + uint frameTypes; // supported frame types (see #DepthCamera::FrameType) + + FilterDescription() {} + +#ifndef SWIG + FilterDescription(const String &n, uint f, _CreateFilter c): name(n), frameTypes(f), _createFilter(c) {} +#endif + + inline bool supports(DepthCamera::FrameType type) + { + return frameTypes & (1 << type); + } + + friend class FilterFactory; +}; + +class POINTCLOUD_EXPORT FilterFactory +{ + +protected: + Map _supportedFilters; + bool _addSupportedFilters(const Vector &f); + + String _name; + +public: + FilterFactory(const String &name): _name(name) {} + + inline const String &name() const { return _name; } + + inline const Map &getSupportedFilters() const { return _supportedFilters; } + + virtual FilterPtr createFilter(const String &name, DepthCamera::FrameType type); +}; + +typedef Ptr FilterFactoryPtr; + +#ifndef SWIG +extern "C" void getFilterFactory(FilterFactoryPtr &filterFactory); +#endif + +typedef void (*GetFilterFactory)(FilterFactoryPtr &filterFactory); // Function type to return DepthCameraFactory + +/** + * @} + */ + +} + + +#endif diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterParameter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterParameter.h new file mode 100644 index 0000000..4a56471 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterParameter.h @@ -0,0 +1,199 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FILTER_PARAMETER_H +#define POINTCLOUD_FILTER_PARAMETER_H + +#include "Common.h" + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class FilterParameter +{ +protected: + String _name, _displayName, _description; + +public: + FilterParameter(const String &name, const String &displayName, const String &description): + _name(name), _displayName(displayName), _description(description) {} + + inline const String &name() const { return _name; } + inline const String &displayName() const { return _displayName; } + inline const String &description() const { return _description; } + + virtual ~FilterParameter() {} +}; + +typedef Ptr FilterParameterPtr; +typedef Ptr FilterParameterConstPtr; + +template +class FilterParameterTemplate: public FilterParameter +{ +protected: + T _value; + +public: + FilterParameterTemplate(const String &name, const String &displayName, const String &description, const T &defaultValue): + FilterParameter(name, displayName, description), _value(defaultValue) {} + + static Ptr> typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast>(other); + } + + virtual bool get(T &v) const { v = _value; return true; } + virtual bool set(const T &v) + { + if(validate(v)) + { + _value = v; + return true; + } + else + return false; + } + + virtual bool validate(const T &v) const = 0; + + virtual ~FilterParameterTemplate() {} +}; + +typedef FilterParameterTemplate BoolFilterParameterTemplate; +typedef FilterParameterTemplate IntegerFilterParameterTemplate; +typedef FilterParameterTemplate UnsignedIntegerFilterParameterTemplate; +typedef FilterParameterTemplate FloatFilterParameterTemplate; + +#ifdef SWIG +%template(BoolFilterParameterTemplate) FilterParameterTemplate; +%template(IntegerFilterParameterTemplate) FilterParameterTemplate; +%template(UnsignedIntegerFilterParameterTemplate) FilterParameterTemplate; +%template(FloatFilterParameterTemplate) FilterParameterTemplate; +#endif + + +template +class FilterParameterRangeTemplate: public FilterParameterTemplate +{ +protected: + T _lowerLimit, _upperLimit; + String _unit; +public: + FilterParameterRangeTemplate(const String &name, const String &displayName, const String &description, const T &defaultValue, + const String &unit, + const T &lowerLimit, const T &upperLimit): + FilterParameterTemplate(name, displayName, description, defaultValue), + _unit(unit), + _lowerLimit(lowerLimit), _upperLimit(upperLimit) {} + + static Ptr> typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast>(other); + } + + inline const T &lowerLimit() const { return _lowerLimit; } + inline const T &upperLimit() const { return _upperLimit; } + + inline const String &unit() const { return _unit; } + + virtual bool validate(const T &v) const + { + return (v >= _lowerLimit && v <= _upperLimit); + } + + virtual ~FilterParameterRangeTemplate() {} +}; + +typedef FilterParameterRangeTemplate UnsignedFilterParameter; +typedef FilterParameterRangeTemplate SignedFilterParameter; +typedef FilterParameterRangeTemplate FloatFilterParameter; + +#ifdef SWIG +%template(SignedFilterParameter) FilterParameterRangeTemplate; +%template(UnsignedFilterParameter) FilterParameterRangeTemplate; +%template(FloatFilterParameter) FilterParameterRangeTemplate; +#endif + + + +template +class FilterParameterEnumTemplate: public FilterParameterTemplate +{ +protected: + Vector _values; + Vector _valueMeaning, _valueDescription; + +public: + FilterParameterEnumTemplate(const String &name, const String &displayName, const String &description, const T &defaultValue, + const Vector &values, const Vector &valueMeaning, const Vector &valueDescription): + FilterParameterTemplate(name, displayName, description, defaultValue), + _values(values), _valueMeaning(valueMeaning), _valueDescription(valueDescription) {} + + static Ptr> typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast>(other); + } + + inline const Vector &valueMeaning() const { return _valueMeaning; } + inline const Vector &valueDescription() const { return _valueDescription; } + inline const Vector &values() const { return _values; } + + virtual bool validate(const T &v) const + { + for(auto t: _values) + { + if(t == v) + return true; + } + return false; + } + + virtual ~FilterParameterEnumTemplate() {} +}; + +typedef FilterParameterEnumTemplate EnumFilterParameter; + +typedef FilterParameterEnumTemplate BoolEnumFilterParameterTemplate; + +#ifdef SWIG +%template(BoolEnumFilterParameterTemplate) FilterParameterEnumTemplate; +%template(EnumFilterParameter) FilterParameterEnumTemplate; +#endif + + +class BoolFilterParameter: public FilterParameterEnumTemplate +{ +public: + BoolFilterParameter(const String &name, const String &displayName, const String &description, const bool &defaultValue, + const Vector &valueMeaning, const Vector &valueDescription): + FilterParameterEnumTemplate(name, displayName, description, defaultValue, {false, true}, + valueMeaning, valueDescription) {} + + + static Ptr typeCast(const FilterParameterPtr &other) + { + return std::dynamic_pointer_cast(other); + } + + + virtual ~BoolFilterParameter() {} +}; + +typedef BoolFilterParameter StrobeBoolFilterParameter; // Typedef StrobeBool to be same Bool parameter + +/** + * @} + */ + +} + +#endif // POINTCLOUD_FILTER_PARAMETER_H \ No newline at end of file diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterSet.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterSet.h new file mode 100644 index 0000000..410bcee --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FilterSet.h @@ -0,0 +1,279 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAME_FILTER_SET_H +#define POINTCLOUD_FRAME_FILTER_SET_H + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +template +class FilterSet; + +template +class FilterSetIterator +{ +public: + int i; + const FilterSet &s; + int index; + + FilterSetIterator(const FilterSet &s, int i = 0); + inline FilterSetIterator &operator++(int); + inline FilterSetIterator &operator++(); + inline const FilterPtr operator *(); + inline bool operator !=(const FilterSetIterator &other) const; + inline bool operator ==(const FilterSetIterator &other) const; +}; + +template +class FilterSet +{ +protected: + Vector _indices; + int _filterCounter; + Map _filters; + + mutable Mutex _accessMutex; + + FrameBufferManager &_frameBufferManager; + +public: + class FrameSequence: public List> + { + public: + ~FrameSequence() + { + while(this->size()) + this->pop_front(); + } + }; + + FilterSet(FrameBufferManager &m): _frameBufferManager(m), _filterCounter(0) { _indices.reserve(10); } + + // position = -1 => at the end, otherwise at zero-indexed 'position' + int addFilter(FilterPtr p, int beforeFilterIndex = -1); + FilterPtr getFilter(int index) const; + bool removeFilter(int index); + bool removeAllFilters(); + + inline SizeType size() const { return _indices.size(); } + + // Populate one entry in 'seq' before calling this function. That entry will be used + // as input to the first filter and then onwards till the last filter. Each filter will + // append one entry which contains the filter frame + bool applyFilter(FrameSequence &seq); + + void reset(); + + FilterSetIterator begin() const + { + return FilterSetIterator(*this, 0); + } + + FilterSetIterator end() const + { + return FilterSetIterator(*this, _indices.size()); + } + + friend class FilterSetIterator; +}; + +template +int FilterSet::addFilter(FilterPtr p, int beforeFilterIndex) +{ + Lock _(_accessMutex); + + if( beforeFilterIndex == -1) + _indices.push_back(_filterCounter); + else + { + auto found = -1; + for(auto i = 0; i < _indices.size(); i++) + if(_indices[i] == beforeFilterIndex) + found = i; + + if(found < 0) + return -1; // -1 => invalid filter index + + _indices.insert(_indices.begin() + found, _filterCounter); + } + + _filters[_filterCounter] = p; + + _frameBufferManager.setMinimumBufferCount(_frameBufferManager.getMinimumBufferCount() + 1); + + int i = _filterCounter; + + _filterCounter++; + + return i; +} + +template +FilterPtr FilterSet::getFilter(int index) const +{ + Lock _(_accessMutex); + + auto x = _filters.find(index); + + if(x != _filters.end()) + return x->second; + else + return nullptr; +} + + +template +bool FilterSet::removeFilter(int index) +{ + Lock _(_accessMutex); + + auto x = _filters.find(index); + + if(x != _filters.end()) + { + for(auto i = 0; i < _indices.size(); i++) + { + if(_indices[i] == index) + { + _indices.erase(_indices.begin() + i); + break; + } + } + _filters.erase(x); + _frameBufferManager.setMinimumBufferCount(_frameBufferManager.getMinimumBufferCount() - 1); + + return true; + } + + return false; +} + +template +bool FilterSet::removeAllFilters() +{ + Lock _(_accessMutex); + + _frameBufferManager.setMinimumBufferCount(_frameBufferManager.getMinimumBufferCount() - _filters.size()); + _filters.clear(); + _indices.clear(); + + return true; +} + +template +bool FilterSet::applyFilter(FrameSequence &seq) +{ + Lock _(_accessMutex); + + if(seq.size() < 1) + { + logger(LOG_ERROR) << "Require atleast one frame in the sequence, to apply filters" << std::endl; + return false; + } + + for(auto f: *this) + { + auto g = _frameBufferManager.get(); + + FramePtr p = std::dynamic_pointer_cast(*g); + + if(!f->filter(std::dynamic_pointer_cast(**seq.begin()), p)) + { + logger(LOG_ERROR) << "FilterSet: Could not apply filter '" << f->name() << "'" << std::endl; + return false; + } + + *g = std::dynamic_pointer_cast(p); + + if(!*g) + { + logger(LOG_ERROR) << "FilterSet: Got an invalid frame from filter '" << f->name() << "'" << std::endl; + return false; + } + + seq.push_front(g); + } + return true; +} + +template +void FilterSet::reset() +{ + for(auto f: *this) + f->reset(); +} + +template +FilterSetIterator::FilterSetIterator(const FilterSet &s, int i): s(s), i(i) +{ + if(i < s._indices.size()) + index = s._indices[i]; +} + +template +inline FilterSetIterator &FilterSetIterator::operator++(int) +{ + i++; + + if(i < s._indices.size()) + index = s._indices[i]; + + return *this; +} + +template +inline FilterSetIterator &FilterSetIterator::operator++() +{ + i++; + + if(i < s._indices.size()) + index = s._indices[i]; + + return *this; +} + +template +inline const FilterPtr FilterSetIterator::operator *() +{ + if(i < s._indices.size()) + { + return s._filters.at(index); + } + else + return nullptr; +} + +template +inline bool FilterSetIterator::operator !=(const FilterSetIterator &other) const +{ + return !operator==(other); +} + +template +inline bool FilterSetIterator::operator ==(const FilterSetIterator &other) const +{ + return (&s == &other.s) && (i == other.i); +} + + +/** + * @} + */ + + +} + +#endif //POINTCLOUD_FRAME_FILTER_SET_H \ No newline at end of file diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/FlyingPixFilter2.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FlyingPixFilter2.h new file mode 100644 index 0000000..7080920 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FlyingPixFilter2.h @@ -0,0 +1,53 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2017.6.1 by liudao + * method: remove jump point + */ + +#ifndef POINTCLOUD_FLYINGPIX2_H +#define POINTCLOUD_FLYINGPIX2_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT FlyingPixFilter2: public Filter +{ +protected: + uint _greaterNum; // 邻域内大于给定值的元素个数 + uint _phaseDiffTh; // phase差值阈值 + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const FramePtr &in_p, FramePtr &out_p); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + FlyingPixFilter2(uint nPhasediffth=10, uint nGreaterNum=4); + + virtual void reset(); + + virtual ~FlyingPixFilter2() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_DARKPIX_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/FlypixFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FlypixFilter.h new file mode 100644 index 0000000..473d573 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/FlypixFilter.h @@ -0,0 +1,50 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) PointCloud.AI Inc. + */ + +#ifndef POINTCLOUD_FLYPIX_H +#define POINTCLOUD_FLYPIX_H + +#include "Filter.h" + +#define _MATH_DEFINES +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT FlypixFilter: public Filter +{ +protected: + float _thr; + + FrameSize _size; + + virtual void _onSet(const FilterParameterPtr &f); + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + FlypixFilter(float thr = 500); + virtual ~FlypixFilter() {} + + virtual void reset(); +}; + + +/** + * @} + */ + +} +#endif // POINTCLOUD_FLYPIX_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/HDRFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/HDRFilter.h new file mode 100644 index 0000000..8c5bbf8 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/HDRFilter.h @@ -0,0 +1,65 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_HDR_H +#define POINTCLOUD_HDR_H + +#include "Filter.h" + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT HDRFilter: public Filter +{ +protected: + uint _order; + + std::deque> _ampHistory; + std::deque> _phaseHistory; + std::deque> _ambHistory; + std::deque> _flagsHistory; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + template + bool _filter2(const FramePtr &in_p, FramePtr &out_p); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + HDRFilter(uint order = 2); + char *buffer; + char *processedbuffer; + + int newId; + int getId() + { + return newId++; + } + + virtual void reset(); + + virtual ~HDRFilter() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_HDR_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/IIRFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/IIRFilter.h new file mode 100644 index 0000000..4ff0f5b --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/IIRFilter.h @@ -0,0 +1,49 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_IIR_H +#define POINTCLOUD_IIR_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class POINTCLOUD_EXPORT IIRFilter: public Filter +{ +protected: + float _gain; + Vector _current; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + +public: + IIRFilter(float gain = 0.5); + + virtual void reset(); + + virtual ~IIRFilter() {} +}; +/** + * @} + */ + +} +#endif // POINTCLOUD_IIR_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/MedianFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/MedianFilter.h new file mode 100644 index 0000000..306c293 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/MedianFilter.h @@ -0,0 +1,51 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_MEDIAN_FILTER_H +#define POINTCLOUD_MEDIAN_FILTER_H + +#include +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class MedianFilter: public Filter +{ +protected: + float _stability, _deadband, _deadbandStep; + uint _halfKernelSize; + + Vector _current, _hist; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + virtual void _onSet(const FilterParameterPtr &f); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + MedianFilter(float stability = 0.1, float deadband = 0.05, float deadbandStep = 0.01, uint halfKernelSize = 1); + virtual ~MedianFilter() {} + + virtual void reset(); +}; + +/** + * @} + */ + + +} +#endif // POINTCLOUD_MEDIAN_FILTER_H \ No newline at end of file diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/NonlinearFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/NonlinearFilter.h new file mode 100644 index 0000000..432af15 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/NonlinearFilter.h @@ -0,0 +1,51 @@ +// +// NonlinearFilter.hpp +// +// + +#ifndef NonlinearFilter_hpp +#define NonlinearFilter_hpp +#include "Filter.h" +#include +#define LIGHT_SPEED 299792458.0 +namespace PointCloud +{ + + /** + * \addtogroup Flt + * @{ + */ + + class POINTCLOUD_EXPORT NonlinearFilter : public Filter + { + protected: + float _modFreq; + Vector _current; + + FrameSize _size; + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + + virtual void _onSet(const FilterParameterPtr &f); + + public: + NonlinearFilter(float frequce = 36); + + virtual void reset(); + + virtual ~NonlinearFilter() {} + float scaleFactor; + static float phase2distance[]; + static int *nonlinearPhase; + static int mapArraySize; + }; + /** + * @} + */ + +} + +#endif /* NonlinearFilter_hpp */ diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/SmoothFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/SmoothFilter.h new file mode 100644 index 0000000..45c58da --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/SmoothFilter.h @@ -0,0 +1,51 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_SMOOTH_H +#define POINTCLOUD_SMOOTH_H + +#include "Filter.h" +#include "DiscreteGaussian.h" + +#define _MATH_DEFINES +#include + +namespace PointCloud +{ + +/** + * \addtogroup Flt + * @{ + */ + +class SmoothFilter: public Filter +{ +protected: + DiscreteGaussian _discreteGaussian; + + FrameSize _size; + + virtual void _onSet(const FilterParameterPtr &f); + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + SmoothFilter(float sigma = 0.5); + virtual ~SmoothFilter() {} + + virtual void reset(); +}; + + +/** + * @} + */ + +} +#endif // POINTCLOUD_SMOOTH_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Filter/TemporalMedianFilter.h b/libs/ubuntu/include/pointcloud-1.0.0/Filter/TemporalMedianFilter.h new file mode 100644 index 0000000..09d042b --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Filter/TemporalMedianFilter.h @@ -0,0 +1,52 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_TEMPORAL_MEDIAN_FILTER_H +#define POINTCLOUD_TEMPORAL_MEDIAN_FILTER_H + +#include "Filter.h" + +#include + +namespace PointCloud +{ +/** + * \addtogroup Flt + * @{ + */ +class TemporalMedianFilter: public Filter +{ +protected: + float _deadband; + uint _order; + + FrameSize _size; + List> _history; + Vector _current; + + virtual void _onSet(const FilterParameterPtr &f); + + template + void _getMedian(IndexType offset, T &value); + + template + bool _filter(const T *in, T *out); + + virtual bool _filter(const FramePtr &in, FramePtr &out); + +public: + TemporalMedianFilter(uint order = 3, float deadband = 0.05); + virtual ~TemporalMedianFilter() {} + + virtual void reset(); +}; + +/** + * @} + */ + +} +#endif // POINTCLOUD_TEMPORAL_MEDIAN_FILTER_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Frame.h b/libs/ubuntu/include/pointcloud-1.0.0/Frame.h new file mode 100644 index 0000000..0d15041 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Frame.h @@ -0,0 +1,784 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAME_H +#define POINTCLOUD_FRAME_H + +#include +#include +#include "VideoMode.h" +#include "SerializedObject.h" + +#include + + +namespace PointCloud +{ + +/** + * \defgroup Frm Frame related classes + * @{ + */ + +class POINTCLOUD_EXPORT Frame +{ +public: + TimeStampType timestamp = 0; // Unix timestamp in micro-seconds + int id = -1; + + inline operator String() + { + std::ostringstream s; + s << id << "@" << timestamp; + return s.str(); + } + + virtual Ptr copy() const = 0; + virtual Ptr copyTo(Ptr &other) const = 0; + virtual Ptr newFrame() const = 0; + + virtual bool isSameType(const Frame &other) const = 0; + virtual bool isSameSize(const Frame &other) const = 0; + + virtual bool serialize(SerializedObject &object) const = 0; + + virtual bool deserialize(SerializedObject &object) = 0; + + virtual ~Frame() {} +}; + +typedef Ptr FramePtr; + +class POINTCLOUD_EXPORT DepthFrame: public Frame +{ +public: + Vector depth; // depth frame row-wise. Unit: meters + Vector amplitude; // amplitude of each depth pixel normalized to value between 0 and 1 + FrameSize size; + + virtual Ptr copy() const + { + Ptr f(new DepthFrame()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new DepthFrame()); + + DepthFrame *d = dynamic_cast(other.get()); + + d->id = id; + d->timestamp = timestamp; + d->depth = depth; + d->amplitude = amplitude; + d->size = size; + return other; + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + depth.size()*sizeof(float)*2 + sizeof(size_t)*2; + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + object.put((const char *)&size.width, sizeof(size.width)); + object.put((const char *)&size.height, sizeof(size.height)); + + object.put((const char *)depth.data(), sizeof(float)*depth.size()); + object.put((const char *)amplitude.data(), sizeof(float)*amplitude.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + if(!object.get((char *)&id, sizeof(id)) || + !object.get((char *)×tamp, sizeof(timestamp)) || + !object.get((char *)&size.width, sizeof(size.width)) || + !object.get((char *)&size.height, sizeof(size.height))) + return false; + + depth.resize(size.width*size.height); + amplitude.resize(size.width*size.height); + + if(!object.get((char *)depth.data(), sizeof(float)*depth.size()) || + !object.get((char *)amplitude.data(), sizeof(float)*amplitude.size())) + return false; + + return true; + } + + virtual bool isSameType(const Frame &other) const + { + const DepthFrame *f = dynamic_cast(&other); + return f; + } + + virtual bool isSameSize(const Frame &other) const + { + const DepthFrame *f = dynamic_cast(&other); + return (f && size == f->size); + } + + virtual Ptr newFrame() const + { + DepthFrame *d = new DepthFrame(); + d->depth.resize(depth.size()); + d->amplitude.resize(amplitude.size()); + d->size = size; + return FramePtr(d); + } + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~DepthFrame() {} +}; + +typedef Ptr DepthFramePtr; + +class POINTCLOUD_EXPORT RawFrame: public Frame +{ +public: + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~RawFrame() {} +}; + +typedef Ptr RawFramePtr; + +enum ToFFrameType { + ToF_PHASE_AMPLITUDE, + ToF_I_Q, + ToF_QUAD +}; + +class POINTCLOUD_EXPORT ToFRawFrame : public RawFrame +{ +public: + virtual const uint8_t *phase() const = 0; + virtual uint8_t *phase() = 0; + virtual SizeType phaseWordWidth() const = 0; // in bytes + + virtual const uint8_t *amplitude() const = 0; + virtual uint8_t *amplitude() = 0; + virtual SizeType amplitudeWordWidth() const = 0; // in bytes + + virtual const uint8_t *flags() const = 0; + virtual uint8_t *flags() = 0; + virtual SizeType flagsWordWidth() const = 0; // in bytes + + virtual const uint8_t *ambient() const = 0; + virtual uint8_t *ambient() = 0; + virtual SizeType ambientWordWidth() const = 0; // in bytes + + virtual const uint16_t *histogram() const = 0; + virtual uint16_t *histogram() = 0; + virtual SizeType histogramSize() const = 0; // number of elements in the histogram + + FrameSize size; + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~ToFRawFrame() {} +}; + +typedef Ptr ToFRawFramePtr; + +template +class POINTCLOUD_EXPORT ToFRawFrameTemplate : public ToFRawFrame +{ +public: + typedef PhaseByteType AmplitudeByteType; + typedef AmbientByteType FlagsByteType; + + Vector _phase; + Vector _amplitude; + + Vector _ambient; + Vector _flags; + + Vector _histogram; + + virtual const uint8_t *ambient() const + { + return (const uint8_t *)_ambient.data(); + } + + virtual uint8_t *ambient() + { + return (uint8_t *)_ambient.data(); + } + + virtual SizeType ambientWordWidth() const + { + return sizeof(AmbientByteType); + } + + virtual const uint8_t *amplitude() const + { + return (const uint8_t *)_amplitude.data(); + } + + virtual uint8_t *amplitude() + { + return (uint8_t *)_amplitude.data(); + } + + virtual SizeType amplitudeWordWidth() const + { + return sizeof(AmplitudeByteType); + } + + virtual const uint8_t *phase() const + { + return (const uint8_t *)_phase.data(); + } + + virtual uint8_t *phase() + { + return (uint8_t *)_phase.data(); + } + + virtual SizeType phaseWordWidth() const + { + return sizeof(PhaseByteType); + } + + virtual const uint8_t *flags() const + { + return (const uint8_t *)_flags.data(); + } + + virtual uint8_t *flags() + { + return (uint8_t *)_flags.data(); + } + + virtual SizeType flagsWordWidth() const + { + return sizeof(FlagsByteType); + } + + virtual const uint16_t *histogram() const + { + return _histogram.data(); + } + + virtual uint16_t *histogram() + { + return _histogram.data(); + } + + virtual SizeType histogramSize() const + { + return _histogram.size(); + } + + virtual Ptr copy() const + { + Ptr f(new ToFRawFrameTemplate()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new ToFRawFrameTemplate()); + + auto *t = dynamic_cast *>(other.get()); + + t->id = id; + t->timestamp = timestamp; + t->_phase = _phase; + t->_amplitude = _amplitude; + t->_ambient = _ambient; + t->_flags = _flags; + t->_histogram = _histogram; + t->size = size; + return other; + } + + virtual Ptr newFrame() const + { + ToFRawFrameTemplate *t = new ToFRawFrameTemplate(); + t->_phase.resize(_phase.size()); + t->_amplitude.resize(_amplitude.size()); + t->_ambient.resize(_ambient.size()); + t->_flags.resize(_flags.size()); + t->_histogram.resize(_histogram.size()); + t->size = size; + return FramePtr(t); + } + + virtual bool isSameType(const Frame &other) const + { + const ToFRawFrameTemplate *f = dynamic_cast *>(&other); + return f; + } + + static Ptr> typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast>(ptr); + } + + virtual bool isSameSize(const Frame &other) const + { + const ToFRawFrameTemplate *f = dynamic_cast *>(&other); + return (f && size == f->size); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + + _phase.size()*sizeof(PhaseByteType) + + _amplitude.size()*sizeof(AmplitudeByteType) + + _ambient.size()*sizeof(AmbientByteType) + + _flags.size()*sizeof(FlagsByteType) + + _histogram.size()*sizeof(uint16_t) + + sizeof(size_t)*2; + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + size_t histogramSize = _histogram.size(); + object.put((const char *)&size.width, sizeof(size.width)); + object.put((const char *)&size.height, sizeof(size.height)); + object.put((const char *)&histogramSize, sizeof(histogramSize)); + + object.put((const char *)_phase.data(), sizeof(PhaseByteType)*_phase.size()); + object.put((const char *)_amplitude.data(), sizeof(AmplitudeByteType)*_amplitude.size()); + object.put((const char *)_ambient.data(), sizeof(AmbientByteType)*_ambient.size()); + object.put((const char *)_flags.data(), sizeof(FlagsByteType)*_flags.size()); + + if(histogramSize) + object.put((const char *)_histogram.data(), sizeof(uint16_t)*_histogram.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + object.get((char *)&id, sizeof(id)); + object.get((char *)×tamp, sizeof(timestamp)); + + size_t histogramSize; + object.get((char *)&size.width, sizeof(size.width)); + object.get((char *)&size.height, sizeof(size.height)); + object.get((char *)&histogramSize, sizeof(histogramSize)); + + unsigned int frameSize = size.width*size.height; + _phase.resize(frameSize); + _amplitude.resize(frameSize); + _ambient.resize(frameSize); + _flags.resize(frameSize); + + object.get((char *)_phase.data(), sizeof(PhaseByteType)*_phase.size()); + object.get((char *)_amplitude.data(), sizeof(AmplitudeByteType)*_amplitude.size()); + object.get((char *)_ambient.data(), sizeof(AmbientByteType)*_ambient.size()); + object.get((char *)_flags.data(), sizeof(FlagsByteType)*_flags.size()); + + if(histogramSize) + { + _histogram.resize(histogramSize); + object.get((char *)_histogram.data(), sizeof(uint16_t)*_histogram.size()); + } + else + _histogram.clear(); + + return true; + } + + virtual ~ToFRawFrameTemplate() {} +}; + + +//typedef ToFRawFrameTemplate Uint1608ToFRawFrameTemplate; + +class POINTCLOUD_EXPORT ToFRawIQFrame: public RawFrame +{ +public: + virtual const uint8_t *i() const = 0; + virtual uint8_t *i() = 0; + virtual const uint8_t *q() const = 0; + virtual uint8_t *q() = 0; + virtual SizeType wordWidth() const = 0; // in bytes + + FrameSize size; + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~ToFRawIQFrame() {} +}; + +typedef Ptr ToFRawIQFramePtr; + +template +class POINTCLOUD_EXPORT ToFRawIQFrameTemplate : public ToFRawIQFrame +{ +public: + Vector _i; + Vector _q; + + virtual const uint8_t *i() const + { + return (const uint8_t *)_i.data(); + } + + virtual uint8_t *i() + { + return (uint8_t *)_i.data(); + } + + virtual const uint8_t *q() const + { + return (const uint8_t *)_q.data(); + } + + virtual uint8_t *q() + { + return (uint8_t *)_q.data(); + } + + virtual SizeType wordWidth() const + { + return sizeof(ByteType); + } + + virtual Ptr copy() const + { + Ptr f(new ToFRawIQFrameTemplate()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if (!other || !isSameType(*other)) + other = Ptr(new ToFRawIQFrameTemplate()); + + auto *t = dynamic_cast *>(other.get()); + t->id = id; + t->timestamp = timestamp; + t->_i = _i; + t->_q = _q; + t->size = size; + return other; + } + + virtual Ptr newFrame() const + { + ToFRawIQFrameTemplate *t = new ToFRawIQFrameTemplate(); + t->_i.resize(_i.size()); + t->_q.resize(_q.size()); + t->size = size; + return FramePtr(t); + } + + virtual bool isSameType(const Frame &other) const + { + const ToFRawIQFrameTemplate *f = dynamic_cast *>(&other); + return f; + } + + int test() + { + return 100; + } + static Ptr> typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast>(ptr); + } + + virtual bool isSameSize(const Frame &other) const + { + const ToFRawIQFrameTemplate *f = dynamic_cast *>(&other); + return (f && size == f->size); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + + _i.size()*sizeof(ByteType) + + _q.size()*sizeof(ByteType) + + sizeof(uint32_t)*2; + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + uint32_t x; + x = sizeof(ByteType); + object.put((const char *)&x, sizeof(x)); + + x = size.width; + object.put((const char *)&x, sizeof(x)); + x = size.height; + object.put((const char *)&x, sizeof(x)); + + object.put((const char *)_i.data(), sizeof(ByteType)*_i.size()); + object.put((const char *)_q.data(), sizeof(ByteType)*_q.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + object.get((char *)&id, sizeof(id)); + object.get((char *)×tamp, sizeof(timestamp)); + + uint32_t x; + object.get((char *)&x, sizeof(x)); + + if(x != sizeof(ByteType)) + return false; + + object.get((char *)&x, sizeof(x)); + size.width = x; + object.get((char *)&x, sizeof(x)); + size.height = x; + + _i.resize(size.width*size.height); + _q.resize(size.width*size.height); + + object.get((char *)_i.data(), sizeof(ByteType)*_i.size()); + object.get((char *)_q.data(), sizeof(ByteType)*_q.size()); + + return true; + } + + virtual ~ToFRawIQFrameTemplate() {} +}; + + +//typedef ToFRawIQFrameTemplate Int16ToFRawIQFrameTemplate; + +class POINTCLOUD_EXPORT RawDataFrame : public RawFrame +{ +public: + Vector data; + + virtual Ptr copy() const + { + Ptr f(new RawDataFrame()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new RawDataFrame()); + + auto *r = dynamic_cast(other.get()); + r->id = id; + r->timestamp = timestamp; + r->data = data; + return other; + } + + virtual Ptr newFrame() const + { + RawDataFrame *r = new RawDataFrame(); + r->data.resize(data.size()); + return FramePtr(r); + } + + virtual bool isSameType(const Frame &other) const + { + const RawDataFrame *f = dynamic_cast(&other); + return f; + } + + virtual bool isSameSize(const Frame &other) const + { + const RawDataFrame *f = dynamic_cast(&other); + return f && data.size() == f->data.size(); + } + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + data.size()*sizeof(ByteType) + sizeof(size_t); + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + s = data.size(); + object.put((const char *)&s, sizeof(s)); + + object.put((const char *)data.data(), sizeof(ByteType)*data.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + size_t s; + if(!object.get((char *)&id, sizeof(id)) || + !object.get((char *)×tamp, sizeof(timestamp)) || + !object.get((char *)&s, sizeof(s))) + return false; + + data.resize(s); + + return object.get((char *)data.data(), sizeof(ByteType)*data.size()); + } + + virtual ~RawDataFrame() {} +}; + +typedef Ptr RawDataFramePtr; + +class POINTCLOUD_EXPORT PointCloudFrame : public Frame +{ +public: + virtual SizeType size() const = 0; + virtual Point *operator [](IndexType index) = 0; + + static Ptr typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast(ptr); + } + + virtual ~PointCloudFrame() {} +}; + +typedef Ptr PointCloudFramePtr; + +template +class POINTCLOUD_EXPORT PointCloudFrameTemplate: public PointCloudFrame +{ +public: + Vector points; + + virtual SizeType size() const + { + return points.size(); + } + + virtual Point *operator[] (IndexType index) + { + if(index < points.size() && index >= 0) + return &points[index]; + else + return 0; + } + + virtual Ptr copy() const + { + Ptr f(new PointCloudFrameTemplate()); + return copyTo(f); + } + + virtual Ptr copyTo(Ptr &other) const + { + if(!other || !isSameType(*other)) + other = Ptr(new PointCloudFrameTemplate()); + + auto *p = dynamic_cast *>(other.get()); + p->id = id; + p->timestamp = timestamp; + p->points = points; + return other; + } + + virtual Ptr newFrame() const + { + PointCloudFrameTemplate *p = new PointCloudFrameTemplate(); + p->points.resize(points.size()); + return FramePtr(p); + } + + virtual bool isSameType(const Frame &other) const + { + const PointCloudFrameTemplate *f = dynamic_cast *>(&other); + return f; + } + + virtual bool isSameSize(const Frame &other) const + { + const PointCloudFrameTemplate *f = dynamic_cast *>(&other); + return f && f->size() == size(); + } + + virtual bool serialize(SerializedObject &object) const + { + size_t s = sizeof(id) + sizeof(timestamp) + points.size()*sizeof(PointType) + sizeof(size_t); + + object.resize(s); + + object.put((const char *)&id, sizeof(id)); + object.put((const char *)×tamp, sizeof(timestamp)); + + s = points.size(); + object.put((const char *)&s, sizeof(s)); + + object.put((const char *)points.data(), sizeof(PointType)*points.size()); + return true; + } + + virtual bool deserialize(SerializedObject &object) + { + object.get((char *)&id, sizeof(id)); + object.get((char *)×tamp, sizeof(timestamp)); + + size_t s; + object.get((char *)&s, sizeof(s)); + + points.resize(s); + + object.get((char *)points.data(), sizeof(ByteType)*points.size()); + return true; + } + + static Ptr> typeCast(FramePtr ptr) + { + return std::dynamic_pointer_cast>(ptr); + } + + virtual ~PointCloudFrameTemplate() {} +}; + +typedef PointCloudFrameTemplate XYZPointCloudFrame; +typedef PointCloudFrameTemplate XYZIPointCloudFrame; + +typedef Ptr XYZPointCloudFramePtr; + +//#if defined(WINDOWS) +//fixed error LNK2019 and error LNK2001 can't find symbol in windows platform +//coz template class can't export symbol in header file +template class POINTCLOUD_EXPORT PointCloudFrameTemplate; +template class POINTCLOUD_EXPORT PointCloudFrameTemplate; +template class POINTCLOUD_EXPORT ToFRawFrameTemplate; +template class POINTCLOUD_EXPORT ToFRawIQFrameTemplate; +//#endif +/** + * @} + */ + +} + +#endif // POINTCLOUD_POINT_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/FrameBuffer.h b/libs/ubuntu/include/pointcloud-1.0.0/FrameBuffer.h new file mode 100644 index 0000000..8534377 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/FrameBuffer.h @@ -0,0 +1,123 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAMEBUFFER_H +#define POINTCLOUD_FRAMEBUFFER_H + +#include +#include + +#include + +#define MAX_FRAME_BUFFERS 2 + +namespace PointCloud +{ + +/** + * \addtogroup Frm + * @{ + */ + + +template +class FrameBufferManager; + +// Auto-releases the obtained buffer when FrameBuffer<> instance is terminated +template +class FrameBuffer: public Ptr +{ +public: + typedef Ptr BufferPtr; + +protected: + BufferPtr &_buffer; + + FrameBufferManager &_manager; + +public: + FrameBuffer(BufferPtr &buffer, FrameBufferManager &manager): _buffer(buffer), _manager(manager), + Ptr(nullptr, [&manager, &buffer](BufferType *) { manager.release(buffer); }) // The deleter gets called when FrameBuffer<> goes out of scope. Deleter releases the held buffer + {} + + inline BufferPtr &operator *() { return _buffer; } + + virtual ~FrameBuffer() {} +}; + +// This maintains a minimum number of buffers for use and re-use. +// Call to release() on unused buffers is important for it be either freed or reused +template +class FrameBufferManager +{ +public: + typedef Ptr BufferPtr; + typedef FrameBuffer FrameBufferType; + +protected: + List _inUse; + List _available; + + SizeType _minimumBufferCount; + +public: + FrameBufferManager(SizeType minBufferCount): _minimumBufferCount(minBufferCount) + { + for(auto i = 0; i < minBufferCount; i++) + _available.push_back(BufferPtr()); + } + + inline void setMinimumBufferCount(SizeType minBufferCount) + { + _minimumBufferCount = (minBufferCount > 0)?minBufferCount:MAX_FRAME_BUFFERS; + } + + inline SizeType getMinimumBufferCount() const + { + return _minimumBufferCount; + } + + FrameBufferType get() + { + if(_available.size() > 0) + _inUse.splice(_inUse.begin(), _available, _available.begin()); + else + _inUse.push_front(BufferPtr()); + + return FrameBufferType(*_inUse.begin(), *this); + } + + bool release(BufferPtr &p) + { + auto f = std::find(_inUse.begin(), _inUse.end(), p); + + if(f == _inUse.end()) + return false; + + if(_available.size() < _minimumBufferCount) + _available.splice(_available.begin(), _inUse, f); + else + _inUse.erase(f); + + return true; + } + + void clear() + { + _inUse.clear(); + _available.clear(); + } + + virtual ~FrameBufferManager() { clear(); } +}; + +/** + * @} + */ + +} + +#endif // FRAMEBUFFER_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/FrameStream.h b/libs/ubuntu/include/pointcloud-1.0.0/FrameStream.h new file mode 100644 index 0000000..7d44aad --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/FrameStream.h @@ -0,0 +1,193 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_FRAME_STREAM_H +#define POINTCLOUD_FRAME_STREAM_H + +#include +#include +#include "DataPacket.h" + +namespace PointCloud +{ + + class CameraSystem; + class POINTCLOUD_EXPORT FrameGenerator; + typedef Ptr FrameGeneratorPtr; + + + struct POINTCLOUD_EXPORT FrameStreamHeader + { + char version[2]; // 0 -> major, 1 -> minor + GeneratorIDType generatorIDs[3]; // For raw (processed), depth and point cloud, in that order + }; + + struct POINTCLOUD_EXPORT FrameStreamPacket: public DataPacket + { + enum PacketType + { + PACKET_DATA = 0, + PACKET_GENERATOR_CONFIG = 1 + }; + + FrameStreamPacket(): DataPacket() {} + }; + + struct POINTCLOUD_EXPORT GeneratorConfigurationSubPacket + { + uint8_t frameType; + uint32_t size; + SerializedObject config; + + bool read(SerializedObject &object); + bool write(SerializedObject &object); + }; + + class POINTCLOUD_EXPORT FrameStreamWriter + { + OutputFileStream &_stream; + OutputFileStream _internalStream; + + Mutex _mutex; + + bool _isPaused = false; + + size_t _frameCount; + FrameStreamHeader _header; + FrameStreamPacket _rawpacket, _configPacket; + GeneratorConfigurationSubPacket _generatorConfigSubPacket; + + bool _writeHeader(); + + bool _init(GeneratorIDType processedRawFrameGeneratorID, GeneratorIDType depthFrameGeneratorID, GeneratorIDType pointCloudFrameGeneratorID); + + public: + FrameStreamWriter(const String &filename, GeneratorIDType processedRawFrameGeneratorID, GeneratorIDType depthFrameGeneratorID, GeneratorIDType pointCloudFrameGeneratorID); + FrameStreamWriter(OutputFileStream &stream, GeneratorIDType processedRawFrameGeneratorID, GeneratorIDType depthFrameGeneratorID, GeneratorIDType pointCloudFrameGeneratorID); + + inline bool isStreamGood() { return _stream.good(); } + + bool pause(); + bool resume(); + inline bool isPaused() { return _isPaused; } + + bool write(FramePtr rawUnprocessed); + + inline SerializedObject &getConfigObject() { return _generatorConfigSubPacket.config; } + bool writeGeneratorConfiguration(uint frameType); + // Assumes the config sub-packet has been populated by using getConfigObject() + + bool close(); + + virtual ~FrameStreamWriter() { close(); } + + + }; + + typedef Ptr FrameStreamWriterPtr; + + class POINTCLOUD_EXPORT FrameStreamReader + { + InputFileStream &_stream; + InputFileStream _internalStream; + + Vector _allPacketOffsets; + + Vector _dataPacketLocation, _configPacketLocation; + + FrameStreamHeader _header; + + size_t _currentPacketIndex; // index on _allPacketOffsets + size_t _currentFrameIndex; // index on _dataPacketLocation + + CameraSystem &_sys; + + FrameGeneratorPtr _frameGenerator[3]; // for processed raw, depth and point cloud + + FrameStreamPacket _dataPacket, _configPacket; + GeneratorConfigurationSubPacket _configSubPacket; + + bool _init(); + + bool _getPacket(size_t packetIndex, FrameStreamPacket &packet); + bool _readConfigPacket(size_t packetIndex); + + public: + + FrameStreamReader(const String &fileName, CameraSystem &sys); + FrameStreamReader(InputFileStream &stream, CameraSystem &sys); + + inline bool isStreamGood() { return _stream.good(); } + + Vector frames; // 4 entries - raw (2 types), depth and point cloud corresponding to currently read frame index + + bool readNext(); + bool seekTo(size_t position); + + FrameStreamHeader *getFrameHeader() + { + return &_header; + } + FrameStreamPacket *getFrameConfigPacket(int idx) + { + if(idx<0||idx>4) + { + return NULL; + } + bool ret= _getPacket(idx, _configPacket); + if(!ret) + { + return NULL; + } + return &_configPacket; + + } + FrameStreamPacket *getFrameCurrDataPacket() + { + return &_dataPacket; + } + + inline size_t currentPosition() { return _currentFrameIndex; } + inline size_t size() { return _dataPacketLocation.size(); } + + template + bool getStreamParam(const String &name, T &value) const; + + bool close(); + + virtual ~FrameStreamReader() {} + }; + + typedef Ptr FrameStreamReaderPtr; + + class POINTCLOUD_EXPORT SocketStreamReader + { + CameraSystem &_sys; + FrameGeneratorPtr _frameGenerator[3]; // for processed raw, depth and point cloud + FrameStreamPacket _dataPacket; + bool _init(); + uint _id1; + uint _id2; + uint _id3; + SerializedObject object; + PointCloud::String _config1; + PointCloud::String _config2; + PointCloud::String _config3; + public: + SocketStreamReader(CameraSystem &sys,uint id1,uint id2,uint id3,char *config1,int len1,char *config2,int len2,char *config3,int len3); + + bool readNext(char *ptr,int tsize); + + template + bool getStreamParam(const String &name, T &value) const; + Vector frames; + virtual ~SocketStreamReader() {} + }; + + typedef Ptr SocketStreamReaderPtr; +} + +#endif diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Logger.h b/libs/ubuntu/include/pointcloud-1.0.0/Logger.h new file mode 100644 index 0000000..a3f738f --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Logger.h @@ -0,0 +1,208 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_LOGGER_H +#define POINTCLOUD_LOGGER_H + +#include +#include +#include + +#include "Common.h" + +namespace PointCloud +{ + +/** + * \addtogroup Util + * @{ + */ + +enum LogLevel +{ + LOG_CRITICAL, + LOG_ERROR, + LOG_WARNING, + LOG_INFO, + LOG_DEBUG +}; + +typedef OutputStream &(*OStreamManipulator)(OutputStream &); + +class POINTCLOUD_EXPORT LoggerOutStream +{ +public: + typedef Function LoggerOutStreamFunctionType; +protected: + LoggerOutStreamFunctionType _outputFunction; + + OutputStringStream _s; + +public: + LoggerOutStream() {} + + void setOutputFunction(LoggerOutStreamFunctionType o) { _outputFunction = o; } + + template + LoggerOutStream &operator <<(const T &value) + { + if(!_outputFunction) + return *this; + + _s << value; + + if(_s.tellp() > 0) // Something written? + { + _outputFunction(_s.str()); + _s.clear(); + _s.str(""); + } + return *this; + } + + inline LoggerOutStream &operator <<(OStreamManipulator manip) + { + (*manip)(_s); + return *this; + } +}; + +class POINTCLOUD_EXPORT Logger +{ +protected: + OutputStream &_out = std::cerr; + + mutable Mutex _mutex; + + LogLevel _logLevel, // Allow log statements equal to or below _logLevel + _currentLogLevel; // This holds log level for current statements + + static const String _logLevelNames[5]; + + Map _outputStreams; + IndexType _outputStreamCount = 0; + +public: + Logger(LogLevel loglevel = LOG_ERROR): _logLevel(loglevel), _currentLogLevel(loglevel) + {} + + Logger &operator =(const Logger &other) { _logLevel = other._logLevel; _currentLogLevel = other._currentLogLevel; return *this; } + + inline Logger &operator()(LogLevel loglevel) + { + _currentLogLevel = loglevel; + return *this << _logLevelNames[loglevel] << ": "; + } + + inline LogLevel getDefaultLogLevel() + { + return _logLevel; + } + + inline LogLevel getCurrentLogLevel() + { + return _currentLogLevel; + } + + inline void setDefaultLogLevel(LogLevel loglevel) + { + _logLevel = loglevel; + } + + inline OutputStream &getStream() + { + return _out; + } + + inline IndexType addOutputStream(LoggerOutStream::LoggerOutStreamFunctionType f) + { + IndexType i = _outputStreamCount; + _outputStreams[i].setOutputFunction(f); + _outputStreamCount++; + return i; + } + + inline bool removeOutputStream(IndexType index) + { + auto x = _outputStreams.find(index); + + if(x != _outputStreams.end()) + { + _outputStreams.erase(x); + return true; + } + return false; + } + + template + Logger &operator <<(const T &value) + { + if(_currentLogLevel <= _logLevel) + { + _out << value; + + for(auto &x: _outputStreams) + x.second << value; + } + return *this; + } + + typedef Logger &(*LoggerManipulator)(Logger &); + + inline Logger &operator <<(LoggerManipulator manip) + { + if(_currentLogLevel <= _logLevel) + return (*manip)(*this); + else + return *this; + } + + inline Logger &operator <<(OStreamManipulator manip) + { + if(_currentLogLevel <= _logLevel) + { + (*manip)(_out); + + for(auto &x: _outputStreams) + x.second << manip; + } + return *this; + } + + virtual ~Logger() + { + } +}; + +extern Logger POINTCLOUD_EXPORT logger; + +//POINTCLOUD_EXPORT Logger & endl(Logger &l); + +class POINTCLOUD_EXPORT LogLevelChanger +{ + LogLevel _currentLogLevel; + LogLevel _desiredLogLevel; +public: + LogLevelChanger(LogLevel desired): _desiredLogLevel(desired) + { + _currentLogLevel = logger.getDefaultLogLevel(); + logger.setDefaultLogLevel(_desiredLogLevel); + } + + ~LogLevelChanger() + { + logger.setDefaultLogLevel(_currentLogLevel); + } +}; + +/** + * @} + */ + + +} + +#endif // POINTCLOUD_LOGGER_H \ No newline at end of file diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Point.h b/libs/ubuntu/include/pointcloud-1.0.0/Point.h new file mode 100644 index 0000000..d6352b2 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Point.h @@ -0,0 +1,135 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_POINT_H +#define POINTCLOUD_POINT_H + +#define _USE_MATH_DEFINES +#include + +#include + +#include "Common.h" + +namespace PointCloud +{ +/** + * \addtogroup Frm + * @{ + */ + + +class Point +{ +public: + float x, y, z; // in meters + + Point(): x(0), y(0), z(0) {} + Point(float x, float y): x(x), y(y), z(0) {} + Point(float x, float y, float z): x(x), y(y), z(z) {} + + inline float angle(const Point &other) const; + inline float norm() const; + + inline float dot(const Point &other) const; + inline Point cross(const Point &other) const; + + inline Point &operator -(); + inline Point operator +(const Point &other) const; + inline Point operator *(const Point &other) const; + inline Point operator *(const float &other) const; +}; + +float Point::dot(const Point &other) const +{ + return (x*other.x + y*other.y + z*other.z); +} + +Point Point::cross(const Point &other) const +{ + Point p; + p.x = y*other.z - z*other.y; + p.y = z*other.x - x*other.z; + p.z = x*other.y - y*other.x; + + return p; +} + + +float Point::angle(const Point &other) const +{ + float n1 = norm(), n2 = other.norm(); + + if(floatEquals(n1, 0) || floatEquals(n2, 0)) + return 0; + + return acos(dot(other)/n1/n2); +} + +float Point::norm() const +{ + return sqrt(x*x + y*y + z*z); +} + +inline Point &Point::operator -() +{ + x = -x; + y = -y; + z = -z; + return *this; +} + +Point Point::operator*(const Point &other) const +{ + return Point(x*other.x, y*other.y, z*other.z); +} + +Point Point::operator*(const float &other) const +{ + return Point(x*other, y*other, z*other); +} + +Point Point::operator +(const Point &other) const +{ + return Point(x + other.x, y + other.y, z + other.z); +} + + + +class POINTCLOUD_EXPORT IntensityPoint: public Point +{ +public: + float i; // normalized 0-1 + + static IntensityPoint *typeCast(Point *ptr) + { + return (IntensityPoint *)(ptr); + } +}; + +class RGBPoint: public Point +{ +public: + float r, g, b; // normalized 0-1 + + static RGBPoint *typeCast(Point *ptr) + { + return (RGBPoint *)(ptr); + } +}; + +class Orientation // in radial co-ordinates +{ +public: + float theta, phi; // in radians +}; +/** + * @} + */ + +} + +#endif // POINTCLOUD_POINT_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/PointCloudConfig.h b/libs/ubuntu/include/pointcloud-1.0.0/PointCloudConfig.h new file mode 100644 index 0000000..970c698 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/PointCloudConfig.h @@ -0,0 +1,16 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_CONFIG_H +#define POINTCLOUD_CONFIG_H + +#define POINTCLOUD_ABI_VERSION 0 +#define POINTCLOUD_MAJOR_VERSION 1 +#define POINTCLOUD_MINOR_VERSION 0 +#define POINTCLOUD_PATCH_VERSION 0 +#define POINTCLOUD_CONF_VERSION 1 + +#endif diff --git a/libs/ubuntu/include/pointcloud-1.0.0/PointCloudExports.h b/libs/ubuntu/include/pointcloud-1.0.0/PointCloudExports.h new file mode 100644 index 0000000..79a70e8 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/PointCloudExports.h @@ -0,0 +1,41 @@ + +#ifndef POINTCLOUD_EXPORT_H +#define POINTCLOUD_EXPORT_H + +#ifdef POINTCLOUD_STATIC_DEFINE +# define POINTCLOUD_EXPORT +# define POINTCLOUD_NO_EXPORT +#else +# ifndef POINTCLOUD_EXPORT +# ifdef pointcloud_EXPORTS + /* We are building this library */ +# define POINTCLOUD_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define POINTCLOUD_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef POINTCLOUD_NO_EXPORT +# define POINTCLOUD_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef POINTCLOUD_DEPRECATED +# define POINTCLOUD_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef POINTCLOUD_DEPRECATED_EXPORT +# define POINTCLOUD_DEPRECATED_EXPORT POINTCLOUD_EXPORT POINTCLOUD_DEPRECATED +#endif + +#ifndef POINTCLOUD_DEPRECATED_NO_EXPORT +# define POINTCLOUD_DEPRECATED_NO_EXPORT POINTCLOUD_NO_EXPORT POINTCLOUD_DEPRECATED +#endif + +#define DEFINE_NO_DEPRECATED 0 +#if DEFINE_NO_DEPRECATED +# define POINTCLOUD_NO_DEPRECATED +#endif + +#endif diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Ptr.h b/libs/ubuntu/include/pointcloud-1.0.0/Ptr.h new file mode 100644 index 0000000..91cf0a1 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Ptr.h @@ -0,0 +1,65 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_PTR_H +#define POINTCLOUD_PTR_H + +#include + +namespace PointCloud +{ + +/** + * \addtogroup Util + * @{ + */ + + +template +void deleter(T *data) +{ + delete data; +} + + +/** + * NOTE: This is a simple way to ensure that matching new/delete are used. + * WARNING: + * 1. DO NOT CREATE the pointer "data" in some other library (so/dll) context and pass it to Ptr<> created in another library (so/dll). + * Always. create Ptr<> and allocate "data" in the same so/dll. + * 2. DO NOT USE THIS CLASS FOR array data, that is, allocated with new[] + */ +template +class Ptr: public std::shared_ptr +{ +public: + Ptr(T *data): std::shared_ptr(data, deleter) {} + + template + Ptr(T *data, _Deleter d): std::shared_ptr(data, d) {} + + Ptr(): std::shared_ptr() {} + + Ptr(const std::shared_ptr &p): std::shared_ptr(p) {} + +#ifdef SWIG + T *operator ->() { return this->std::shared_ptr::operator->(); } + + const T *operator ->() const { return this->std::shared_ptr::operator->(); } +#endif + + virtual ~Ptr() {} +}; + +/** + * @} + */ + + +} + + +#endif // POINTCLOUD_PTR_H \ No newline at end of file diff --git a/libs/ubuntu/include/pointcloud-1.0.0/SerializedObject.h b/libs/ubuntu/include/pointcloud-1.0.0/SerializedObject.h new file mode 100644 index 0000000..283e13b --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/SerializedObject.h @@ -0,0 +1,86 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_SERIALIZED_OBJECT_H +#define POINTCLOUD_SERIALIZED_OBJECT_H + +#include "Common.h" + +#include + +#include + +namespace PointCloud +{ + +class POINTCLOUD_EXPORT SerializedObject +{ +protected: + Vector _bytes; + uint _getOffset, _putOffset; + +public: + SerializedObject(size_t size): _bytes(size), _getOffset(0), _putOffset(0) {} + SerializedObject(): _getOffset(0), _putOffset(0) {} + + uint currentGetOffset() const { return _getOffset; } + uint currentPutOffset() const { return _putOffset; } + + const Vector &getBytes() const { return _bytes; } + Vector &getBytes() { return _bytes; } + + inline void resize(size_t size) + { + if(size > 0) + _bytes.resize(size); + else + _bytes.clear(); + rewind(); + } + + inline size_t size() const { return _bytes.size(); } + + inline void rewind() { _getOffset = 0; _putOffset = 0; } + + inline size_t get(char *bytes, size_t size); + inline size_t put(const char *bytes, size_t size); + + virtual ~SerializedObject() {} +}; + +size_t SerializedObject::get(char *bytes, size_t size) +{ + size = std::min(size, _bytes.size() - _getOffset); + + if(size == 0) + return 0; + + memcpy(bytes, _bytes.data() + _getOffset, size); + + _getOffset += size; + + return size; +} + +size_t SerializedObject::put(const char *bytes, size_t size) +{ + size = std::min(size, _bytes.size() - _putOffset); + + if(size == 0) + return 0; + + memcpy(_bytes.data() + _putOffset, bytes, size); + + _putOffset += size; + + return size; +} + + +} + + +#endif diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Streamer.h b/libs/ubuntu/include/pointcloud-1.0.0/Streamer.h new file mode 100644 index 0000000..3fda226 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Streamer.h @@ -0,0 +1,62 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_STREAMER_H +#define POINTCLOUD_STREAMER_H + +#include "Device.h" +#include "Frame.h" +#include "VideoMode.h" +#include "Timer.h" + +namespace PointCloud +{ +/** + * \addtogroup IO + * @{ + */ + + +class POINTCLOUD_EXPORT Streamer +{ +protected: + DevicePtr _device; + + Timer _time; + + int _currentID = -1; + TimeStampType _currentTimeStamp = 0; + + bool _isRunning = false; + + virtual bool _start() = 0; + virtual bool _capture(RawDataFramePtr &p) = 0; + virtual bool _stop() = 0; + +public: + Streamer(DevicePtr device): _device(device) {} + + virtual ~Streamer(); + + virtual bool isInitialized() = 0; + virtual bool isRunning() { return _isRunning; } + + virtual bool start(); + virtual bool capture(RawDataFramePtr &p); + virtual bool stop(); + + virtual bool getSupportedVideoModes(Vector &videoModes) = 0; + + virtual bool getCurrentVideoMode(VideoMode &videoMode) = 0; + virtual bool setVideoMode(const VideoMode &videoMode) = 0; +}; +/** + * @} + */ + +} + +#endif // STREAMER_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/Timer.h b/libs/ubuntu/include/pointcloud-1.0.0/Timer.h new file mode 100644 index 0000000..2dd32e5 --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/Timer.h @@ -0,0 +1,49 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_TIME_H +#define POINTCLOUD_TIME_H + +#include "Common.h" + +namespace PointCloud +{ + +/** + * \addtogroup Util + * @{ + */ + + +class POINTCLOUD_EXPORT Timer +{ + TimeStampType _realTimeStart = 0, _monoticStart = 0; + + bool _initialized = false; + +public: + Timer() + { + init(); + } + + inline bool isInitialized() { return _initialized; } + + bool init(); + + // Assumption: MONOTIC clock's epoch began recently while REALTIME's epoch began a long time ago (~44 years ago) + TimeStampType convertToRealTime(TimeStampType l); + + TimeStampType getCurrentRealTime(); +}; + +/** + * @} + */ + +} + +#endif // POINTCLOUD_TIME_H diff --git a/libs/ubuntu/include/pointcloud-1.0.0/VideoMode.h b/libs/ubuntu/include/pointcloud-1.0.0/VideoMode.h new file mode 100644 index 0000000..b75433d --- /dev/null +++ b/libs/ubuntu/include/pointcloud-1.0.0/VideoMode.h @@ -0,0 +1,95 @@ +/* + * PointCloud Lib component. + * + * Copyright (c) 2018 PointCloud.ai Inc. + */ + +#ifndef POINTCLOUD_VIDEO_MODE_H +#define POINTCLOUD_VIDEO_MODE_H + +#include + +namespace PointCloud +{ +/** + * \addtogroup Frm + * @{ + */ + +class FrameSize +{ +public: + uint32_t width, height; + + inline bool operator ==(const FrameSize &other) const + { + return width == other.width && height == other.height; + } + + inline bool operator !=(const FrameSize &other) const + { + return !operator==(other); + } +}; + +class RegionOfInterest: public FrameSize +{ +public: + uint32_t x, y; + + inline bool operator ==(const RegionOfInterest &other) const + { + return width == other.width && height == other.height && x == other.x && y == other.y; + } + + inline bool operator !=(const RegionOfInterest &other) const + { + return !operator==(other); + } +}; + +class FrameRate +{ +public: + uint32_t numerator, denominator; + + inline float getFrameRate() const { return (denominator == 0)?0:(((float)numerator)/denominator); } +}; + +class VideoMode +{ +public: + FrameSize frameSize; + FrameRate frameRate; + + inline float getFrameRate() const { return frameRate.getFrameRate(); } +}; + +class SupportedVideoMode: public VideoMode +{ +public: + uint8_t bytesPerPixel; + + SupportedVideoMode(): bytesPerPixel(0) + { + frameSize.width = frameSize.height = 0; + frameRate.numerator = 0; + frameRate.denominator = 1; + } + + SupportedVideoMode(uint32_t width, uint32_t height, uint32_t rateNumerator, uint32_t rateDenominator, uint8_t bytesPerPixel) + { + frameSize.width = width; + frameSize.height = height; + frameRate.numerator = rateNumerator; + frameRate.denominator = rateDenominator; + this->bytesPerPixel = bytesPerPixel; + } +}; +/** + * @} + */ + +} + +#endif // POINTCLOUD_POINT_H diff --git a/libs/ubuntu/lib/cmake/PointCloud/PointCloudConfig.cmake b/libs/ubuntu/lib/cmake/PointCloud/PointCloudConfig.cmake new file mode 100644 index 0000000..a1eb08c --- /dev/null +++ b/libs/ubuntu/lib/cmake/PointCloud/PointCloudConfig.cmake @@ -0,0 +1,19 @@ +# - Config file for the FooBar package +# It defines the following variables +# POINTCLOUD_INCLUDE_DIRS - include directories for FooBar +# POINTCLOUD_LIBRARIES - libraries to link against + +# Compute paths +get_filename_component(POINTCLOUD_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(POINTCLOUD_INCLUDE_DIRS ${POINTCLOUD_CMAKE_DIR}/../../../include/pointcloud-1.0.0 ${POINTCLOUD_CMAKE_DIR}/Util/) +#set(POINTCLOUD_INCLUDE_DIRS ${POINTCLOUD_CMAKE_DIR}/../../../include/pointcloud-1.0.0 COMMON_INCLUDE) + +set(POINTCLOUD_ABI_VERSION 0) + +# Our library dependencies (contains definitions for IMPORTED targets) +if(NOT TARGET PointCloud::pointcloud AND NOT PointCloud_BINARY_DIR) + include("${POINTCLOUD_CMAKE_DIR}/PointCloudTargets.cmake") +endif() + +# These are IMPORTED targets created by FooBarTargets.cmake +set(POINTCLOUD_LIBRARIES PointCloud::pointcloud) diff --git a/libs/ubuntu/lib/cmake/PointCloud/PointCloudConfigVersion.cmake b/libs/ubuntu/lib/cmake/PointCloud/PointCloudConfigVersion.cmake new file mode 100644 index 0000000..e4f4fc8 --- /dev/null +++ b/libs/ubuntu/lib/cmake/PointCloud/PointCloudConfigVersion.cmake @@ -0,0 +1,11 @@ +set(PACKAGE_VERSION "1.0.0") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/libs/ubuntu/lib/cmake/PointCloud/PointCloudTargets-noconfig.cmake b/libs/ubuntu/lib/cmake/PointCloud/PointCloudTargets-noconfig.cmake new file mode 100644 index 0000000..bc6124b --- /dev/null +++ b/libs/ubuntu/lib/cmake/PointCloud/PointCloudTargets-noconfig.cmake @@ -0,0 +1,19 @@ +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Import target "PointCloud::pointcloud" for configuration "" +set_property(TARGET PointCloud::pointcloud APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) +set_target_properties(PointCloud::pointcloud PROPERTIES + IMPORTED_LOCATION_NOCONFIG "${_IMPORT_PREFIX}/lib/libpointcloud.so" + IMPORTED_SONAME_NOCONFIG "libpointcloud.so" + ) + +list(APPEND _IMPORT_CHECK_TARGETS PointCloud::pointcloud ) +list(APPEND _IMPORT_CHECK_FILES_FOR_PointCloud::pointcloud "${_IMPORT_PREFIX}/lib/libpointcloud.so" ) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) diff --git a/libs/ubuntu/lib/cmake/PointCloud/PointCloudTargets.cmake b/libs/ubuntu/lib/cmake/PointCloud/PointCloudTargets.cmake new file mode 100644 index 0000000..43c8cc9 --- /dev/null +++ b/libs/ubuntu/lib/cmake/PointCloud/PointCloudTargets.cmake @@ -0,0 +1,92 @@ +# Generated by CMake 3.5.1 + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget PointCloud::pointcloud) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) + +# Create imported target PointCloud::pointcloud +add_library(PointCloud::pointcloud SHARED IMPORTED) + +set_target_properties(PointCloud::pointcloud PROPERTIES + INTERFACE_LINK_LIBRARIES "usb-1.0;dl" +) + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/PointCloudTargets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/libs/ubuntu/lib/libpointcloud.so b/libs/ubuntu/lib/libpointcloud.so new file mode 100644 index 0000000..31df083 Binary files /dev/null and b/libs/ubuntu/lib/libpointcloud.so differ diff --git a/libs/ubuntu/lib/plugin/libSonycdk.so b/libs/ubuntu/lib/plugin/libSonycdk.so new file mode 100644 index 0000000..ce4a644 Binary files /dev/null and b/libs/ubuntu/lib/plugin/libSonycdk.so differ diff --git a/libs/ubuntu/lib/python2.7/PointCloud.py b/libs/ubuntu/lib/python2.7/PointCloud.py new file mode 100644 index 0000000..9a09710 --- /dev/null +++ b/libs/ubuntu/lib/python2.7/PointCloud.py @@ -0,0 +1,188 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 3.0.2 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + + + + + +from sys import version_info +if version_info >= (2,6,0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_PointCloud', [dirname(__file__)]) + except ImportError: + import _PointCloud + return _PointCloud + if fp is not None: + try: + _mod = imp.load_module('_PointCloud', fp, pathname, description) + finally: + fp.close() + return _mod + _PointCloud = swig_import_helper() + del swig_import_helper +else: + import _PointCloud +del version_info +from _PointCloud import * +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. +def _swig_setattr_nondynamic(self,class_type,name,value,static=1): + if (name == "thisown"): return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name,None) + if method: return method(self,value) + if (not static): + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + +def _swig_setattr(self,class_type,name,value): + return _swig_setattr_nondynamic(self,class_type,name,value,0) + +def _swig_getattr(self,class_type,name): + if (name == "thisown"): return self.this.own() + method = class_type.__swig_getmethods__.get(name,None) + if method: return method(self) + raise AttributeError(name) + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except AttributeError: + class _object : pass + _newclass = 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# This file is compatible with both classic and new-style classes. + + diff --git a/libs/ubuntu/lib/python2.7/_PointCloud.so b/libs/ubuntu/lib/python2.7/_PointCloud.so new file mode 100644 index 0000000..3c80021 Binary files /dev/null and b/libs/ubuntu/lib/python2.7/_PointCloud.so differ diff --git a/libs/ubuntu/share/pointcloud-1.0.0/conf/SONY556IMX.dml b/libs/ubuntu/share/pointcloud-1.0.0/conf/SONY556IMX.dml new file mode 100644 index 0000000..265e3f0 --- /dev/null +++ b/libs/ubuntu/share/pointcloud-1.0.0/conf/SONY556IMX.dml @@ -0,0 +1,1221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+
+ + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
diff --git a/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCamera.conf b/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCamera.conf new file mode 100644 index 0000000..9d0ff0e --- /dev/null +++ b/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCamera.conf @@ -0,0 +1,8 @@ +[core] +dml = SONY556IMX.dml +camera_profiles = SonyCDKCameraNormal.conf +default_profile = 130 + +[observed_params] +tsensor = refresh:5 +tillum = refresh:5 \ No newline at end of file diff --git a/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCamera70cm8phase60mhzPhaseOffset.bin b/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCamera70cm8phase60mhzPhaseOffset.bin new file mode 100644 index 0000000..668d26b Binary files /dev/null and b/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCamera70cm8phase60mhzPhaseOffset.bin differ diff --git a/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCameraNormal.conf b/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCameraNormal.conf new file mode 100644 index 0000000..2255e03 --- /dev/null +++ b/libs/ubuntu/share/pointcloud-1.0.0/conf/SonyCDKCameraNormal.conf @@ -0,0 +1,73 @@ +[global] +id = 130 +name = Normal + +[defining_params] +#make sure to send this register at first after power-on = inck frequency[mhz] +unambiguous_range = 4.96 #7.45 +intg_time = 100 #100 +mod_freq1 = 60 +sub_rseq_lnum = 40 #40 #3 + +[params] +#mode setting +rngchken = 0 +dutof_mode = 0 #4 +hmax = 1800 #1900 #1388 #1700 #2304 +micr_lnum = 10000 #10000 #2500 +dpth_su_num = 30 +binning_mode = 0 #3 +phases_num = 8 +#sub_fnum = 8 #4 +#gdphs0 = 0 +#gdphs1 = 2 +#gdphs2 = 4 +#gdphs3 = 6 +#gdphs0 = 0 +#gdphs1 = 1 +#gdphs2 = 2 +#gdphs3 = 3 +#gdphs4 = 4 +#gdphs5 = 5 +#gdphs6 = 6 +#gdphs7 = 7 + +#exarea_intg_00 = 96000 +#exarea_intg_01 = 96000 +#exarea_intg_02 = 96000 +#exarea_intg_03 = 96000 +#exarea_intg_04 = 96000 +#exarea_intg_05 = 96000 +#exarea_intg_06 = 96000 +#exarea_intg_07 = 96000 +dlycnt = 5 +anadlycnt = 14 #40 +dlycntsf = 0 # 10 + +[calib] +fy = 478 #59.75 #478 #247.0 +fx = 478 #59.75 #478 #247.0 +cx = 319 #39.875 #319.0 +cy = 239 #29.8 #239.0 +k1 = -0.0 +k2 = -0.0 +k3 = 0.00 +p1 = 0.00 +p2 = 0.00 +calib_disable = 14 #78 +actual_distance = 0.7 +tsensor_calib = 39 #60 +tillum_calib = 0 +phase_corr_2 = 0 +phase_corr_1 = -131 #69 #-194 +disable_offset_corr = 0 #0 +phasecorrection = file:SonyCDKCamera70cm8phase60mhzPhaseOffset.bin + +#freq_corr = 1 +#freq_corr_at = 36 +#phase_lin_coeff = 15 132 246 364 491 654 777 912 1039 +#phase_lin_corr_period = 0 +disable_temp_corr = 0 +coeff_illum = 0 +coeff_sensor = 5 +#calib_prec = 8 \ No newline at end of file diff --git a/libs/windows/README.md b/libs/windows/README.md new file mode 100644 index 0000000..e69de29 diff --git a/tools/README.MD b/tools/README.MD new file mode 100644 index 0000000..547c7b3 --- /dev/null +++ b/tools/README.MD @@ -0,0 +1,16 @@ +# Tools Collection + +## PointCloudTool +PointCloudTool is a visualization tool which is based on the libPointCloud SDK API. It can be used to display depth data for PointCloud.AI® DepthEye™ depth cameras. + +### Features +* Scalable and Rotating Point Clouds +* More than ten kinds of filtering +* Follow the mouse to display depth, light intensity and other information +* Supporting display of multi-point's depth, light intensity and other information +* Support to record & replay point cloud video +* Depth, light intensity and point clouds can be displayed separately or on the same screen +* Rendering point clouds with multiple colors based on different distances + +### PointCloudTool snapshot +![PointCloud Tool ](https://raw.githubusercontent.com/pointcloudAI/libPointCloud/master/doc/image/snapshotMain.jpg)