D:/users/ricard/src/utilitats/cpp/cvblobslib/BlobResult.h

Go to the documentation of this file.
00001 /************************************************************************
00002                         BlobResult.h
00003                         
00004 FUNCIONALITAT: Definició de la classe CBlobResult
00005 AUTOR: Inspecta S.L.
00006 MODIFICACIONS (Modificació, Autor, Data):
00007 
00008 FUNCTIONALITY: Definition of the CBlobResult class
00009 AUTHOR: Inspecta S.L.
00010 MODIFICATIONS (Modification, Author, Date):
00011 
00012 **************************************************************************/
00013 
00014 
00015 #if !defined(_CLASSE_BLOBRESULT_INCLUDED)
00016 #define _CLASSE_BLOBRESULT_INCLUDED
00017 
00018 #if _MSC_VER > 1000 
00019 #pragma once
00020 #endif // _MSC_VER > 1000
00021 
00024 #define MATRIXCV_ACTIU
00025 
00026 #include <math.h>
00027 #include "cxcore.h"
00028 
00029 #ifdef MATRIXCV_ACTIU
00030         #include "matrixCV.h"
00031 #else
00032         // llibreria STL
00033         #include "vector"
00035         typedef std::vector<double> double_stl_vector;
00036 #endif
00037 
00038 #include <vector>               // vectors de la STL
00039 #include <functional>
00040 #include "Blob.h"
00041 
00042 /**************************************************************************
00043         Filtres / Filters
00044 **************************************************************************/
00045 
00048 #define B_INCLUDE                               1L
00049 #define B_EXCLUDE                               2L
00050 
00053 #define B_EQUAL                                 3L
00054 #define B_NOT_EQUAL                             4L
00055 #define B_GREATER                               5L
00056 #define B_LESS                                  6L
00057 #define B_GREATER_OR_EQUAL              7L
00058 #define B_LESS_OR_EQUAL                 8L
00059 #define B_INSIDE                            9L
00060 #define B_OUTSIDE                           10L
00061 
00062 
00063 /**************************************************************************
00064         Excepcions / Exceptions
00065 **************************************************************************/
00066 
00068 #define EXCEPTION_BLOB_OUT_OF_BOUNDS    1000
00069 #define EXCEPCIO_CALCUL_BLOBS                   1001
00070 
00072 typedef std::vector<CBlob*>     blob_vector;
00073 
00081 class CBlobResult  
00082 {
00083 public:
00084 
00087         CBlobResult();
00090         CBlobResult(IplImage *source, IplImage *mask, int threshold, bool findmoments);
00093         CBlobResult( const CBlobResult &source );
00095         virtual ~CBlobResult();
00096 
00099         CBlobResult& operator=(const CBlobResult& source);
00102         CBlobResult operator+( const CBlobResult& source );
00103         
00106         void AddBlob( CBlob *blob );
00107 
00108 #ifdef MATRIXCV_ACTIU
00111         double_vector GetResult( funcio_calculBlob *evaluador ) const;
00112 #endif
00115         double_stl_vector GetSTLResult( funcio_calculBlob *evaluador ) const;
00116         
00119         double GetNumber( int indexblob, funcio_calculBlob *evaluador ) const;
00120 
00123         void Filter(CBlobResult &dst,
00124                                 int filterAction, funcio_calculBlob *evaluador, 
00125                                 int condition, double lowLimit, double highLimit = 0 );
00126                         
00129         void GetNthBlob( funcio_calculBlob *criteri, int nBlob, CBlob &dst ) const;
00130         
00133         CBlob GetBlob(int indexblob) const;
00134         CBlob *GetBlob(int indexblob);
00135         
00138         void ClearBlobs();
00139 
00142         void PrintBlobs( char *nom_fitxer ) const;
00143 
00144 
00145 //Metodes GET/SET
00146 
00149         int GetNumBlobs() const 
00150         { 
00151                 return(m_blobs.size()); 
00152         }
00153 
00154 
00155 private:
00156 
00159         void RaiseError(const int errorCode) const;
00160 
00161 protected:
00162 
00165         blob_vector             m_blobs;
00166 };
00167 
00168 #endif // !defined(_CLASSE_BLOBRESULT_INCLUDED)

Generated on Mon Nov 13 13:32:49 2006 for cvBlobsLib by  doxygen 1.5.1-p1