00001 /*M/////////////////////////////////////////////////////////////////////////////////////// 00002 // 00003 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 00004 // 00005 // By downloading, copying, installing or using the software you agree to this license. 00006 // If you do not agree to this license, do not download, install, 00007 // copy or use the software. 00008 // 00009 // 00010 // License Agreement 00011 // For Open Source Computer Vision Library 00012 // 00013 // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 00014 // Third party copyrights are property of their respective owners. 00015 // 00016 // Redistribution and use in source and binary forms, with or without modification, 00017 // are permitted provided that the following conditions are met: 00018 // 00019 // * Redistribution's of source code must retain the above copyright notice, 00020 // this list of conditions and the following disclaimer. 00021 // 00022 // * Redistribution's in binary form must reproduce the above copyright notice, 00023 // this list of conditions and the following disclaimer in the documentation 00024 // and/or other materials provided with the distribution. 00025 // 00026 // * The name of the copyright holders may not be used to endorse or promote products 00027 // derived from this software without specific prior written permission. 00028 // 00029 // This software is provided by the copyright holders and contributors "as is" and 00030 // any express or implied warranties, including, but not limited to, the implied 00031 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00032 // In no event shall the Intel Corporation or contributors be liable for any direct, 00033 // indirect, incidental, special, exemplary, or consequential damages 00034 // (including, but not limited to, procurement of substitute goods or services; 00035 // loss of use, data, or profits; or business interruption) however caused 00036 // and on any theory of liability, whether in contract, strict liability, 00037 // or tort (including negligence or otherwise) arising in any way out of 00038 // the use of this software, even if advised of the possibility of such damage. 00039 // 00040 // Authors: 00041 // * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com 00042 // 00043 //M*/ 00044 00045 #ifndef RTABMAP__vtkImageMatSource_h 00046 #define RTABMAP__vtkImageMatSource_h 00047 00048 #include <opencv2/core/core.hpp> 00049 #include <vtkImageAlgorithm.h> 00050 #include <vtkSmartPointer.h> 00051 00052 namespace rtabmap 00053 { 00054 class vtkImageMatSource : public vtkImageAlgorithm 00055 { 00056 public: 00057 static vtkImageMatSource *New(); 00058 vtkTypeMacro(vtkImageMatSource, vtkImageAlgorithm); 00059 00060 void SetImage(cv::InputArray image); 00061 00062 protected: 00063 vtkImageMatSource(); 00064 ~vtkImageMatSource() {} 00065 00066 vtkSmartPointer<vtkImageData> ImageData; 00067 00068 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*); 00069 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*); 00070 private: 00071 vtkImageMatSource(const vtkImageMatSource&); // Not implemented. 00072 void operator=(const vtkImageMatSource&); // Not implemented. 00073 00074 static void copyGrayImage(const cv::Mat &source, vtkSmartPointer<vtkImageData> output); 00075 static void copyRGBImage(const cv::Mat &source, vtkSmartPointer<vtkImageData> output); 00076 static void copyRGBAImage(const cv::Mat &source, vtkSmartPointer<vtkImageData> output); 00077 }; 00078 } 00079 00080 00081 #endif