CudaFramework.H
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 #ifndef CUDAFRAMEWORK_H_DEFINED
00038 #define CUDAFRAMEWORK_H_DEFINED
00039 
00040 #include <stdio.h>
00041 #include <stdlib.h>
00042 #include <string.h>
00043 #include <pthread.h>
00044 #include <errno.h>
00045 #include <GL/glew.h>
00046 #include <cuda_runtime.h>
00047 #include <cuda_gl_interop.h>
00048 #include "CUDA/CudaImage.H"
00049 #include "CUDA/CudaImageSet.H"
00050 #include "Image/Pixels.H"
00051 #include "Image/MathOps.H"
00052 #if defined(__APPLE__) || defined(MACOSX)
00053 #include <GLUT/glut.h>
00054 #else
00055 #include <GL/glut.h>
00056 #endif
00057 
00058 #include "CudaImageDisplay.h"
00059 #include <unistd.h>
00060 #include "CUDA/CudaShapeOps.H"
00061 #include "Raster/Raster.H"
00062 #include "Raster/PngWriter.H"
00063 #include "CUDA/CudaCutPaste.H"
00064 #include "Component/ModelManager.H"
00065 #include "CUDA/CudaSaliency.H"
00066 #include "Image/SimpleFont.H"
00067 #include "Image/DrawOps.H"
00068 #include "Raster/Raster.H"
00069 #include "Raster/GenericFrame.H"
00070 #include "Media/FrameSeries.H"
00071 #define MAX_SIZE 14
00072 
00073 class CudaFramework
00074 {
00075 
00076 public:
00077 
00078 
00079 
00080   CudaFramework();
00081 
00082 
00083 
00084   ~CudaFramework();
00085 
00086 
00087 
00088   int getCanvasW();
00089 
00090 
00091 
00092   int getCanvasH();
00093 
00094 
00095 
00096   CudaImage<PixRGB<float> >& getCanvas();
00097 
00098 
00099 
00100   Point2D<int> getPoint(int i);
00101 
00102 
00103 
00104   MemoryPolicy getMP();
00105 
00106 
00107 
00108   int getDev();
00109 
00110 
00111 
00112   int getLockAtt();
00113 
00114 
00115 
00116   bool getCanvasModified();
00117 
00118 
00119 
00120   int getW();
00121 
00122 
00123 
00124   int getH();
00125 
00126 
00127 
00128   void setMP(MemoryPolicy mp);
00129 
00130 
00131 
00132   void setDev(int dev);
00133 
00134 
00135 
00136   void setMutexDestroy();
00137 
00138 
00139 
00140   void setMutexUnlock();
00141 
00142 
00143 
00144   void setCanvasModified(bool new_state);
00145 
00146 
00147 
00148   void setPoint(int i,Point2D<int> pt);
00149 
00150 
00151 
00152   void setW(int W);
00153 
00154 
00155 
00156   void setH(int H);
00157 
00158 
00159 
00160   void updateCanvas(int i, CudaImage<PixRGB<float> > &src);
00161 
00162 
00163 
00164   void startFramework(int w,int h,int dev,MemoryPolicy mp);
00165 
00166 
00167   void drawRectangle_centrepoint(Point2D<int> centre_point, const PixRGB<float> color,const int w,const int h, const int rad);
00168 
00169 
00170   void drawRectangle_topleftpoint(Point2D<int> topleft_point, const PixRGB<float> color,const int w,const int h, const int rad);
00171 
00172 
00173   void setText(const char* text,Point2D<int> text_coord,const PixRGB<float> color,const PixRGB<float> bgcolor,const SimpleFont& f,bool transparent_background);
00174 
00175 
00176   void initTextLayer(int w,int h);
00177 
00178 private:
00179 
00180   Point2D<int> point_list[MAX_SIZE];
00181   int dev1;
00182   MemoryPolicy mp1;
00183   int w,h;
00184   CudaImage<PixRGB<float> > canvas_image;
00185   pthread_mutex_t canvas_lock;
00186   bool canvasModified;
00187   int saliency_rectangle_size ;
00188   Image<PixRGB<float> > text_patch;
00189   CudaImage<PixRGB<float> > text_patch_cuda;
00190 };
00191 
00192 #endif
00193 
00194 
00195 
00196 
00197 
00198 
00199