LadybugVirtualCamera.h
Go to the documentation of this file.
00001 /*
00002  * LadybugVirtualCamera.h
00003  *
00004  *  Created on: Aug 5, 2010
00005  *      Author: petrito1@cmp.felk.cvut.cz
00006  */
00007 
00008 #ifndef NIFTI_LADYBUG_LADYBUGVIRTUALCAMERA_H_
00009 #define NIFTI_LADYBUG_LADYBUGVIRTUALCAMERA_H_
00010 
00011 #include <GL/glew.h>
00012 #include <GL/gl.h>
00013 
00014 #include <opencv2/core/core.hpp>
00015 
00016 namespace nifti {
00017 namespace ladybug {
00018 
00026 class LadybugVirtualCamera {
00027 private:
00028   static const int NUM_CAMERAS = 6;
00029 
00033   int viewportWidth;
00037   int viewportHeight;
00038 
00042   double pan;
00046   double tilt;
00050   double horizontalFov;
00054   double verticalFov;
00055 
00059   int meshCols;
00063   int meshRows;
00069   double* mesh[NUM_CAMERAS];
00070 
00074   bool alphamaskAvailable;
00078   int alphaMaskWidths[NUM_CAMERAS];
00082   int alphaMaskHeights[NUM_CAMERAS];
00088   unsigned char* alphamasks[NUM_CAMERAS];
00089 
00093   int imageWidths[NUM_CAMERAS];
00097   int imageHeights[NUM_CAMERAS];
00098 
00102   GLuint glTextures[NUM_CAMERAS];
00106   int glTextureWidths[NUM_CAMERAS];
00110   int glTextureHeights[NUM_CAMERAS];
00114   bool initialized;
00118   bool offScreenRendering;
00122   GLuint frameBuffer;
00126   GLuint colorRenderBuffer;
00130   GLuint depthRenderBuffer;
00131 
00135   int getMinimumPowerOfTwo(int n);
00136 
00140   void updateBuffers();
00141 
00145   void deleteBuffers();
00149   void initializeTextures();
00153   void initializeFramebuffers();
00154 
00155 public:
00156   LadybugVirtualCamera();
00157   virtual ~LadybugVirtualCamera();
00158 
00164   void initialize(bool offScreenRendering);
00165 
00169   void loadMesh(const std::string& meshFile);
00173   void clearMesh();
00174 
00179   void loadAlphamask(const std::string& alphamaskFilePrefix);
00180 
00185   void clearAlphamask();
00186 
00190   void setImage(const int& i, const cv::Mat& image);
00194   void setImages(const cv::Mat(&images)[NUM_CAMERAS]);
00198   void setImages(const cv::Mat& composite);
00199 
00203   void renderView(cv::Mat& image);
00204 
00205   void getViewport(int* viewportWidth, int* viewportHeight);
00206   void setViewport(int viewportWidth, int viewportHeight);
00207 
00208   double getPan();
00209   void setPan(double pan);
00210   double getTilt();
00211   void setTilt(double tilt);
00212   double getHorizontalFov();
00213   void setHorizontalFov(double horizontalFov);
00214   double getVerticalFov();
00215   void setVerticalFov(double verticalFov);
00216 
00217   // Made public so the they can be used as GLUT callbacks:
00221   void updateViewport();
00222 
00226   void updateProjection();
00227 
00231   void updateModelView();
00232 
00236   void render();
00237 
00241   void clearBuffers();
00242 
00246   bool isInitialized();
00247 
00248 };
00249 
00250 }
00251 }
00252 
00253 #endif /* NIFTI_LADYBUG_LADYBUGVIRTUALCAMERA_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Defines


omnicamera
Author(s): Tomas Petricek / petrito1@cmp.felk.cvut.cz
autogenerated on Tue Dec 10 2013 14:26:53