00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 00033 00034 00035 #ifndef __CAMERACVD_H_ 00036 #define __CAMERACVD_H_ 00037 00038 #ifdef MIP_HOST_APPLE 00039 #include <applePatch.h> 00040 #endif 00041 00042 00043 #include <Camera.h> 00044 00045 #include <TooN/TooN.h> 00046 using namespace TooN::Internal; 00047 00048 #include <cvd/Linux/v4lbuffer.h> 00049 #include <cvd/colourspace_convert.h> 00050 #include <cvd/colourspaces.h> 00051 #include <cvd/image.h> 00052 #include <cvd/byte.h> 00053 #include <cvd/rgb.h> 00054 00055 00056 00057 using namespace std; 00058 using namespace MipResources; 00059 00060 using namespace CVD; 00061 00062 namespace MipResources{ 00064 /* @{ */ 00065 00070 00071 00075 class CameraCVDOptions : public Options { 00076 public: 00077 StringOption *sourceName; 00078 IntOption *width; 00079 IntOption *height; 00080 IntOption *frameRate; 00081 00082 DecimalOption *focal; 00083 00084 BoolOption *make_video_log; 00085 StringOption *log_name; 00086 00087 CameraCVDOptions(); 00088 string getObjectName() const { 00089 return "CameraCVD"; 00090 } 00091 OptionGroupsType getGroup() { 00092 return OPT_GRP_RESO; 00093 } 00094 }; 00095 00099 class CameraCVDVar : public CameraVar { 00100 public: 00101 CameraCVDVar(){} 00102 00103 int cam_width; 00104 int cam_height; 00105 int cam_depth; 00106 CvSize imgSize; 00107 00108 cv::VideoWriter *videoWriter; 00109 }; 00110 00114 class CameraCVD : public Camera{ 00115 protected: 00116 CameraCVDVar* _var; 00117 CameraCVDOptions _options; 00118 V4LBuffer<yuv422>* _pvb; 00119 VideoFrame<yuv422>* _pVidFrame; 00120 Image<Rgb<byte> > _frameRGB; 00121 00122 public: 00125 CameraCVD(int argc, const char* argv[]); 00126 00128 ~CameraCVD(); 00129 00132 ResourcePlate getPlate() const { 00133 return CAM_CVD_RES; 00134 } 00135 00140 virtual bool getFrame(IplImage*& s, MipBaselib::Time& t); 00141 00146 virtual bool getFrame(cv::Mat& s, Time& t); 00147 00152 virtual bool getFrame(Image <Rgb<byte> > *& s, MipBaselib::Time& t); 00153 00156 virtual bool recordLastFrame(); 00157 00160 virtual CameraCVDVar* getVar(void){ 00161 return _var; 00162 } 00163 00164 // Luca Ricci mod. // 00165 inline virtual timeval getTimeStamp() 00166 { 00167 timeval temp; 00168 return temp; 00169 }; 00170 // ************** // 00171 }; 00172 }; // end of namespace 00173 00174 00175 #endif 00176 00177 /* @} */ 00178 00179 00180 00181