Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLGeom/src/ICLGeom/PointCloudCreatorCL.h ** 00010 ** Module : ICLGeom ** 00011 ** Authors: Andre Ueckermann ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.GPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 00033 #include <ICLGeom/PointCloudObjectBase.h> 00034 #include <ICLCore/Img.h> 00035 00036 #ifdef HAVE_OPENCL 00037 #include <CL/cl.hpp> 00038 #endif 00039 00040 namespace icl{ 00041 namespace geom{ 00044 class PointCloudCreatorCL{ 00045 00046 public: 00048 00051 PointCloudCreatorCL(utils::Size size, const utils::Array2D<Vec> &dirs); 00052 00054 ~PointCloudCreatorCL(); 00055 00057 void create(bool NEEDS_RAW_TO_MM_MAPPING,const core::Img32f *depthValues, 00058 const Vec O, const int DEPTH_DIM, 00059 DataSegment<float,3> xyz, const utils::Array2D<Vec> &dirs, float depthScaling); 00060 00062 void createRGB(bool NEEDS_RAW_TO_MM_MAPPING,const core::Img32f *depthValues, const Mat M, 00063 const Vec O, const unsigned int COLOR_W, const unsigned int COLOR_H, const int DEPTH_DIM, 00064 DataSegment<float,3> xyz, DataSegment<float,4> rgba, 00065 const core::Img8u *rgbIn,const utils::Array2D<Vec> &dirs, float depthScaling); 00066 00068 00069 bool isCLReady(); 00070 00071 private: 00072 bool clReady; 00073 00074 #ifdef HAVE_OPENCL 00075 //OpenCL data 00076 float* depthValuesArray; 00077 cl_uchar* rInArray; 00078 cl_uchar* gInArray; 00079 cl_uchar* bInArray; 00080 float* dirsArray; 00081 float* xyzData; 00082 cl_float4* rgbaData; 00083 00084 //OpenCL 00085 cl::Context context; 00086 std::vector<cl::Device> devices; 00087 cl::Program program; 00088 cl::CommandQueue queue; 00089 00090 cl::Kernel kernelCreate; 00091 cl::Kernel kernelCreateRGB; 00092 00093 //OpenCL buffer 00094 cl::Buffer depthValuesBuffer; 00095 cl::Buffer matrixBuffer; 00096 cl::Buffer xyzBuffer; 00097 cl::Buffer rgbaBuffer; 00098 cl::Buffer rInBuffer; 00099 cl::Buffer gInBuffer; 00100 cl::Buffer bInBuffer; 00101 cl::Buffer dirsBuffer; 00102 #endif 00103 }; 00104 } // namespace geom 00105 }