Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
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
00022 #include "BlobLibraryConfiguration.h"
00023 #include <math.h>
00024 #include "cxcore.h"
00025
00026 #ifdef MATRIXCV_ACTIU
00027 #include "matrixCV.h"
00028 #else
00029
00030 #include "vector"
00032 typedef std::vector<double> double_stl_vector;
00033 #endif
00034
00035 #include <vector>
00036 #include <functional>
00037 #include "Blob.h"
00038 #include "BlobOperators.h"
00039 #include "ComponentLabeling.h"
00040
00041
00042
00043
00046 #define B_INCLUDE 1L
00047 #define B_EXCLUDE 2L
00048
00051 #define B_EQUAL 3L
00052 #define B_NOT_EQUAL 4L
00053 #define B_GREATER 5L
00054 #define B_LESS 6L
00055 #define B_GREATER_OR_EQUAL 7L
00056 #define B_LESS_OR_EQUAL 8L
00057 #define B_INSIDE 9L
00058 #define B_OUTSIDE 10L
00059
00060
00061
00062
00063
00064
00066 #define EXCEPTION_BLOB_OUT_OF_BOUNDS 1000
00067 #define EXCEPCIO_CALCUL_BLOBS 1001
00068
00076 class CBlobResult
00077 {
00078 public:
00079
00082 CBlobResult();
00085 CBlobResult(IplImage *source, IplImage *mask, uchar backgroundColor);
00088 CBlobResult( const CBlobResult &source );
00090 virtual ~CBlobResult();
00091
00094 CBlobResult& operator=(const CBlobResult& source);
00097 CBlobResult operator+( const CBlobResult& source ) const;
00098
00101 void AddBlob( CBlob *blob );
00102
00103 #ifdef MATRIXCV_ACTIU
00104
00105
00106 double_vector GetResult( funcio_calculBlob *evaluador ) const;
00107 #endif
00108
00109
00110 double_stl_vector GetSTLResult( funcio_calculBlob *evaluador ) const;
00111
00114 double GetNumber( int indexblob, funcio_calculBlob *evaluador ) const;
00115
00118 void Filter(CBlobResult &dst,
00119 int filterAction, funcio_calculBlob *evaluador,
00120 int condition, double lowLimit, double highLimit = 0 );
00121 void Filter(CBlobResult &dst,
00122 int filterAction, funcio_calculBlob *evaluador,
00123 int condition, double lowLimit, double highLimit = 0 ) const;
00124
00127 void GetNthBlob( funcio_calculBlob *criteri, int nBlob, CBlob &dst ) const;
00128
00131 CBlob GetBlob(int indexblob) const;
00132 CBlob *GetBlob(int indexblob);
00133
00136 void ClearBlobs();
00137
00140 void PrintBlobs( char *nom_fitxer ) const;
00141
00142
00143
00144
00147 int GetNumBlobs() const
00148 {
00149 return(m_blobs.size());
00150 }
00151
00152
00153 private:
00154
00157 void RaiseError(const int errorCode) const;
00158
00160 void DoFilter(CBlobResult &dst,
00161 int filterAction, funcio_calculBlob *evaluador,
00162 int condition, double lowLimit, double highLimit = 0) const;
00163
00164 protected:
00165
00168 Blob_vector m_blobs;
00169 };
00170
00171 #endif // !defined(_CLASSE_BLOBRESULT_INCLUDED)