Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
grabber.hpp
00001 /* $Id$ */
00002 
00003 #ifndef _GRABBER_HPP
00004 #define _GRABBER_HPP
00005 
00006 #include "kernel/jafarException.hpp"
00007 #include "jmath/jblas.hpp"
00008 #include "image/Image.hpp"
00009 #include <map>
00010 #include <opencv/cxcore.h>
00011 #if CV_MAJOR_VERSION*10 + CV_MINOR_VERSION > 21
00012 #include <opencv2/imgproc/imgproc.hpp>
00013 #else
00014 #include <cv.hpp>
00015 #include <cvtypes.h>
00016 #endif
00017 
00018 namespace jafar {
00019   
00020   namespace cutter {    
00021     
00029     class Grabber {
00030     public:
00032       typedef enum surface_type {DARK, LIGHT};
00033     private:
00034       jafar::image::Image m_image;
00035       jafar::image::Image m_result;
00036       std::multimap<unsigned int, int> boxes;
00037       cv::Rect largest;
00038       cv::Rect plausible;
00040       void findContoursOfInterest();
00042       void grab();
00044       surface_type m_surface;
00045     public:
00047       Grabber(const image::Image& image, surface_type surface=LIGHT);
00049       Grabber(const std::string& imageFile, surface_type surface=LIGHT);
00051       void run();
00053       const image::Image& source() const;
00055       const image::Image& result() const;
00059       void writeImages(const std::string& srcFileName="source.png",
00060            const std::string& objFileName="result.png");
00062       const cv::Rect& backgroundBorders() const;
00064       const cv::Rect& objectBorders() const;
00065     };
00066 
00067   }//namespace cutter
00068 
00069 }//namespace jafar
00070 
00071 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:17 for Jafar by doxygen 1.7.6.1
LAAS-CNRS