00001
00002
00003 #ifndef CAMERA_MASK_HPP
00004 #define CAMERA_MASK_HPP
00005
00006 #include <list>
00007
00008 #include "jmath/jblas.hpp"
00009
00010 #include "image/Image.hpp"
00011
00012 #include "camera/cameraBarreto.hpp"
00013
00014 namespace jafar {
00015 namespace camera {
00016
00017
00024 class CameraMask
00025 {
00026 private:
00027 jafar::image::Image *mask;
00028 jafar::image::Image *dilatedMask;
00029 int clearColor;
00030 int width, height;
00031
00032 void createDilatedMask();
00033 void createCircleMask(double u0, double v0, double imageRadius, double maskRadius, int width, int height);
00034 void createImageMask(jafar::image::Image *mask, int width, int height);
00035
00036 public:
00037 CameraMask(int width, int height);
00038 CameraMask(char* maskFileName, int width = -1, int height = -1, int clearColor = 0);
00042 CameraMask(jafar::image::Image *mask, int width = -1, int height = -1, int clearColor = 0);
00043 CameraMask(double uCenter, double vCenter, double imageRadius, int width, int height, double maskRadius = 0, int clearColor = 0);
00044 CameraMask(CameraBarreto const& camera, int width = -1, int height = -1, int clearColor = 0);
00045 ~CameraMask();
00046
00050 void apply(jafar::image::Image& image) const;
00054 bool isMasked(int u, int v) const;
00055 };
00056
00057
00062 class PanoMask {
00063
00064 private:
00065
00066 int p_width, p_height;
00067
00068 typedef boost::numeric::ublas::bounded_vector<int,2> Pixel;
00069
00070 typedef std::list<Pixel> MaskType;
00071 MaskType mask;
00072
00073 int p_clearColor;
00074
00075 void createMask(double u0, double v0,
00076 double imageRadius, double maskRadius);
00077
00078 public:
00079
00080 PanoMask();
00081
00082 PanoMask(int width, int height,
00083 double uCenter, double vCenter,
00084 double imageRadius, double maskRadius,
00085 int clearColor = 0);
00086
00087 PanoMask(CameraBarreto const& camera,
00088 int clearColor = 0);
00089
00090 void setup(int width, int height,
00091 double uCenter, double vCenter,
00092 double imageRadius, double maskRadius,
00093 int clearColor = 0);
00094
00095 void setup(CameraBarreto const& camera,
00096 int clearColor = 0);
00097
00098 void apply(jafar::image::Image& image) const;
00099
00100 };
00101
00102 }
00103 }
00104
00105 #endif // CAMERA_MASK_HPP