Go to the documentation of this file.00001
00033 #ifndef __D_MASK__
00034 #define __D_MASK__
00035
00036 #include <opencv/cv.h>
00037 #include <opencv/highgui.h>
00038 #include <vector>
00039
00040 class Mask
00041 {
00042 public:
00043
00048 Mask(const char *filename);
00049
00054 Mask(const cv::Mat &mask);
00055
00056 virtual ~Mask();
00057
00063 void shrink(int margin);
00064
00069 inline bool empty() const;
00070
00074 void reset();
00075
00081 void maskKeyPoints(std::vector<cv::KeyPoint> &keys);
00082
00088 void getPointsOutsideMask(const std::vector<cv::KeyPoint> &keys,
00089 std::vector<unsigned int> &i_out) const;
00090
00095 inline bool test(int x, int y) const
00096 {
00097 return x >= 0 && x < m_current_mask.cols &&
00098 y >= 0 && y < m_current_mask.rows &&
00099 m_current_mask.at<unsigned char>(y, x) != 0;
00100 }
00101
00102 protected:
00103
00105 cv::Mat m_original_mask;
00106
00108 cv::Mat m_current_mask;
00109
00110 };
00111
00112
00113
00114 inline bool Mask::empty() const
00115 {
00116 return this->m_original_mask.empty();
00117 }
00118
00119
00120
00121 #endif