Added utility function for angle_to object

This commit is contained in:
Philip Rosedale 2013-01-24 17:41:17 -08:00
commit e88c64ee92
554 changed files with 54317 additions and 55441 deletions

BIN
.DS_Store vendored

Binary file not shown.

View file

@ -1,99 +1,99 @@
#ifndef BLOBCONTOUR_H_INCLUDED
#define BLOBCONTOUR_H_INCLUDED
#include "list"
#include <opencv/cv.h>
//#include "cxtypes.h" //AO
#include <opencv/cxcore.h> //
//! Type of chain codes
typedef unsigned char t_chainCode;
//! Type of list of chain codes
typedef CvSeq* t_chainCodeList;
//! Type of list of points
typedef CvSeq* t_PointList;
//! Max order of calculated moments
#define MAX_MOMENTS_ORDER 3
//! Blob contour class (in crack code)
class CBlobContour
{
friend class CBlob;
friend class CBlobProperties; //AO
public:
//! Constructors
CBlobContour();
CBlobContour(CvPoint startPoint, CvMemStorage *storage );
//! Copy constructor
CBlobContour( CBlobContour *source );
~CBlobContour();
//! Assigment operator
CBlobContour& operator=( const CBlobContour &source );
//! Add chain code to contour
void AddChainCode(t_chainCode code);
//! Return freeman chain coded contour
t_chainCodeList GetChainCode()
{
return m_contour;
}
bool IsEmpty()
{
return m_contour == NULL || m_contour->total == 0;
}
//! Return all contour points
t_chainCodeList GetContourPoints();
protected:
CvPoint GetStartPoint() const
{
return m_startPoint;
}
//! Clears chain code contour
void ResetChainCode();
//! Computes area from contour
double GetArea();
//! Computes perimeter from contour
double GetPerimeter();
//! Get contour moment (p,q up to MAX_CALCULATED_MOMENTS)
double GetMoment(int p, int q);
//! Crack code list
t_chainCodeList m_contour;
private:
//! Starting point of the contour
CvPoint m_startPoint;
//! All points from the contour
t_PointList m_contourPoints;
//! Computed area from contour
double m_area;
//! Computed perimeter from contour
double m_perimeter;
//! Computed moments from contour
CvMoments m_moments;
//! Pointer to storage
CvMemStorage *m_parentStorage;
};
#endif //!BLOBCONTOUR_H_INCLUDED
#ifndef BLOBCONTOUR_H_INCLUDED
#define BLOBCONTOUR_H_INCLUDED
#include "list"
#include <opencv/cv.h>
//#include "cxtypes.h" //AO
#include <opencv/cxcore.h> //
//! Type of chain codes
typedef unsigned char t_chainCode;
//! Type of list of chain codes
typedef CvSeq* t_chainCodeList;
//! Type of list of points
typedef CvSeq* t_PointList;
//! Max order of calculated moments
#define MAX_MOMENTS_ORDER 3
//! Blob contour class (in crack code)
class CBlobContour
{
friend class CBlob;
friend class CBlobProperties; //AO
public:
//! Constructors
CBlobContour();
CBlobContour(CvPoint startPoint, CvMemStorage *storage );
//! Copy constructor
CBlobContour( CBlobContour *source );
~CBlobContour();
//! Assigment operator
CBlobContour& operator=( const CBlobContour &source );
//! Add chain code to contour
void AddChainCode(t_chainCode code);
//! Return freeman chain coded contour
t_chainCodeList GetChainCode()
{
return m_contour;
}
bool IsEmpty()
{
return m_contour == NULL || m_contour->total == 0;
}
//! Return all contour points
t_chainCodeList GetContourPoints();
protected:
CvPoint GetStartPoint() const
{
return m_startPoint;
}
//! Clears chain code contour
void ResetChainCode();
//! Computes area from contour
double GetArea();
//! Computes perimeter from contour
double GetPerimeter();
//! Get contour moment (p,q up to MAX_CALCULATED_MOMENTS)
double GetMoment(int p, int q);
//! Crack code list
t_chainCodeList m_contour;
private:
//! Starting point of the contour
CvPoint m_startPoint;
//! All points from the contour
t_PointList m_contourPoints;
//! Computed area from contour
double m_area;
//! Computed perimeter from contour
double m_perimeter;
//! Computed moments from contour
CvMoments m_moments;
//! Pointer to storage
CvMemStorage *m_parentStorage;
};
#endif //!BLOBCONTOUR_H_INCLUDED

View file

@ -1,22 +1,22 @@
/************************************************************************
BlobLibraryConfiguration.h
FUNCIONALITAT: Configuració del comportament global de la llibreria
AUTOR: Inspecta S.L.
MODIFICACIONS (Modificació, Autor, Data):
FUNCTIONALITY: Global configuration of the library
AUTHOR: Inspecta S.L.
MODIFICATIONS (Modification, Author, Date):
**************************************************************************/
//! Indica si es volen fer servir les MatrixCV o no
//! Use/Not use the MatrixCV class
//#define MATRIXCV_ACTIU
//! Uses/not use the blob object factory
//#define BLOB_OBJECT_FACTORY
//! Show/not show blob access errors
//#define _SHOW_ERRORS //AO: Only works for WIN.
/************************************************************************
BlobLibraryConfiguration.h
FUNCIONALITAT: Configuració del comportament global de la llibreria
AUTOR: Inspecta S.L.
MODIFICACIONS (Modificació, Autor, Data):
FUNCTIONALITY: Global configuration of the library
AUTHOR: Inspecta S.L.
MODIFICATIONS (Modification, Author, Date):
**************************************************************************/
//! Indica si es volen fer servir les MatrixCV o no
//! Use/Not use the MatrixCV class
//#define MATRIXCV_ACTIU
//! Uses/not use the blob object factory
//#define BLOB_OBJECT_FACTORY
//! Show/not show blob access errors
//#define _SHOW_ERRORS //AO: Only works for WIN.

View file

@ -1,70 +1,70 @@
//! Disable warnings referred to 255 character truncation for the std:map
#pragma warning( disable : 4786 )
#ifndef BLOB_PROPERTIES_H_INCLUDED
#define BLOB_PROPERTIES_H_INCLUDED
#include <opencv/cxcore.h>
#include "BlobLibraryConfiguration.h"
#include "BlobContour.h"
#ifdef BLOB_OBJECT_FACTORY
//! Object factory pattern implementation
#include "..\inspecta\DesignPatterns\ObjectFactory.h"
#endif
//! Type of labelled images
typedef unsigned int t_labelType;
//! Max order of calculated moments
#define MAX_MOMENTS_ORDER 3
//! Blob class
class CBlobProperties
{
typedef std::list<CBlobContour> t_contourList;
public:
CBlobProperties();
virtual ~CBlobProperties();
//! Get blob area
double GetArea();
//! Get blob perimeter
double GetPerimeter();
//! Get contour moment (p,q up to MAX_CALCULATED_MOMENTS)
double GetMoment(int p, int q);
//////////////////////////////////////////////////////////////////////////
// Blob contours
//////////////////////////////////////////////////////////////////////////
//! Contour storage memory
CvMemStorage *m_storage;
//! External contour of the blob (crack codes)
CBlobContour m_externalContour;
//! Internal contours (crack codes)
t_contourList m_internalContours;
private:
//! Computed area from blob
double m_area;
//! Computed perimeter from blob
double m_perimeter;
// Computed moment from the blob
double m_moment[MAX_MOMENTS_ORDER*MAX_MOMENTS_ORDER];
};
#endif //!BLOB_PROPERTIES_H_INCLUDED
//! Disable warnings referred to 255 character truncation for the std:map
#pragma warning( disable : 4786 )
#ifndef BLOB_PROPERTIES_H_INCLUDED
#define BLOB_PROPERTIES_H_INCLUDED
#include <opencv/cxcore.h>
#include "BlobLibraryConfiguration.h"
#include "BlobContour.h"
#ifdef BLOB_OBJECT_FACTORY
//! Object factory pattern implementation
#include "..\inspecta\DesignPatterns\ObjectFactory.h"
#endif
//! Type of labelled images
typedef unsigned int t_labelType;
//! Max order of calculated moments
#define MAX_MOMENTS_ORDER 3
//! Blob class
class CBlobProperties
{
typedef std::list<CBlobContour> t_contourList;
public:
CBlobProperties();
virtual ~CBlobProperties();
//! Get blob area
double GetArea();
//! Get blob perimeter
double GetPerimeter();
//! Get contour moment (p,q up to MAX_CALCULATED_MOMENTS)
double GetMoment(int p, int q);
//////////////////////////////////////////////////////////////////////////
// Blob contours
//////////////////////////////////////////////////////////////////////////
//! Contour storage memory
CvMemStorage *m_storage;
//! External contour of the blob (crack codes)
CBlobContour m_externalContour;
//! Internal contours (crack codes)
t_contourList m_internalContours;
private:
//! Computed area from blob
double m_area;
//! Computed perimeter from blob
double m_perimeter;
// Computed moment from the blob
double m_moment[MAX_MOMENTS_ORDER*MAX_MOMENTS_ORDER];
};
#endif //!BLOB_PROPERTIES_H_INCLUDED

View file

@ -1,171 +1,171 @@
/************************************************************************
BlobResult.h
FUNCIONALITAT: Definició de la classe CBlobResult
AUTOR: Inspecta S.L.
MODIFICACIONS (Modificació, Autor, Data):
FUNCTIONALITY: Definition of the CBlobResult class
AUTHOR: Inspecta S.L.
MODIFICATIONS (Modification, Author, Date):
**************************************************************************/
#if !defined(_CLASSE_BLOBRESULT_INCLUDED)
#define _CLASSE_BLOBRESULT_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BlobLibraryConfiguration.h"
#include <math.h>
#include <opencv/cxcore.h>
#ifdef MATRIXCV_ACTIU
#include "matrixCV.h"
#else
// llibreria STL
#include "vector"
//! Vector de doubles
typedef std::vector<double> double_stl_vector;
#endif
#include <vector> // vectors de la STL
#include <functional>
#include "blob.h"
#include "BlobOperators.h"
#include "ComponentLabeling.h"
/**************************************************************************
Filtres / Filters
**************************************************************************/
//! accions que es poden fer amb els filtres
//! Actions performed by a filter (include or exclude blobs)
#define B_INCLUDE 1L
#define B_EXCLUDE 2L
//! condicions sobre els filtres
//! Conditions to apply the filters
#define B_EQUAL 3L
#define B_NOT_EQUAL 4L
#define B_GREATER 5L
#define B_LESS 6L
#define B_GREATER_OR_EQUAL 7L
#define B_LESS_OR_EQUAL 8L
#define B_INSIDE 9L
#define B_OUTSIDE 10L
/**************************************************************************
Excepcions / Exceptions
**************************************************************************/
//! Excepcions llençades per les funcions:
#define EXCEPTION_BLOB_OUT_OF_BOUNDS 1000
#define EXCEPCIO_CALCUL_BLOBS 1001
/**
Classe que conté un conjunt de blobs i permet extreure'n propietats
o filtrar-los segons determinats criteris.
Class to calculate the blobs of an image and calculate some properties
on them. Also, the class provides functions to filter the blobs using
some criteria.
*/
class CBlobResult
{
public:
//! constructor estandard, crea un conjunt buit de blobs
//! Standard constructor, it creates an empty set of blobs
CBlobResult();
//! constructor a partir d'una imatge
//! Image constructor, it creates an object with the blobs of the image
CBlobResult(IplImage *source, IplImage *mask, uchar backgroundColor);
//! constructor de còpia
//! Copy constructor
CBlobResult( const CBlobResult &source );
//! Destructor
virtual ~CBlobResult();
//! operador = per a fer assignacions entre CBlobResult
//! Assigment operator
CBlobResult& operator=(const CBlobResult& source);
//! operador + per concatenar dos CBlobResult
//! Addition operator to concatenate two sets of blobs
CBlobResult operator+( const CBlobResult& source ) const;
//! Afegeix un blob al conjunt
//! Adds a blob to the set of blobs
void AddBlob( CBlob *blob );
#ifdef MATRIXCV_ACTIU
//! Calcula un valor sobre tots els blobs de la classe retornant una MatrixCV
//! Computes some property on all the blobs of the class
double_vector GetResult( funcio_calculBlob *evaluador ) const;
#endif
//! Calcula un valor sobre tots els blobs de la classe retornant un std::vector<double>
//! Computes some property on all the blobs of the class
double_stl_vector GetSTLResult( funcio_calculBlob *evaluador ) const;
//! Calcula un valor sobre un blob de la classe
//! Computes some property on one blob of the class
double GetNumber( int indexblob, funcio_calculBlob *evaluador ) const;
//! Retorna aquells blobs que compleixen les condicions del filtre en el destination
//! Filters the blobs of the class using some property
void Filter(CBlobResult &dst,
int filterAction, funcio_calculBlob *evaluador,
int condition, double lowLimit, double highLimit = 0 );
void Filter(CBlobResult &dst,
int filterAction, funcio_calculBlob *evaluador,
int condition, double lowLimit, double highLimit = 0 ) const;
//! Retorna l'enèssim blob segons un determinat criteri
//! Sorts the blobs of the class acording to some criteria and returns the n-th blob
void GetNthBlob( funcio_calculBlob *criteri, int nBlob, CBlob &dst ) const;
//! Retorna el blob enèssim
//! Gets the n-th blob of the class ( without sorting )
CBlob GetBlob(int indexblob) const;
CBlob *GetBlob(int indexblob);
//! Elimina tots els blobs de l'objecte
//! Clears all the blobs of the class
void ClearBlobs();
//! Escriu els blobs a un fitxer
//! Prints some features of all the blobs in a file
void PrintBlobs( char *nom_fitxer ) const;
//Metodes GET/SET
//! Retorna el total de blobs
//! Gets the total number of blobs
int GetNumBlobs() const
{
return(m_blobs.size());
}
private:
//! Funció per gestionar els errors
//! Function to manage the errors
void RaiseError(const int errorCode) const;
//! Does the Filter method job
void DoFilter(CBlobResult &dst,
int filterAction, funcio_calculBlob *evaluador,
int condition, double lowLimit, double highLimit = 0) const;
protected:
//! Vector amb els blobs
//! Vector with all the blobs
Blob_vector m_blobs;
};
#endif // !defined(_CLASSE_BLOBRESULT_INCLUDED)
/************************************************************************
BlobResult.h
FUNCIONALITAT: Definició de la classe CBlobResult
AUTOR: Inspecta S.L.
MODIFICACIONS (Modificació, Autor, Data):
FUNCTIONALITY: Definition of the CBlobResult class
AUTHOR: Inspecta S.L.
MODIFICATIONS (Modification, Author, Date):
**************************************************************************/
#if !defined(_CLASSE_BLOBRESULT_INCLUDED)
#define _CLASSE_BLOBRESULT_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BlobLibraryConfiguration.h"
#include <math.h>
#include <opencv/cxcore.h>
#ifdef MATRIXCV_ACTIU
#include "matrixCV.h"
#else
// llibreria STL
#include "vector"
//! Vector de doubles
typedef std::vector<double> double_stl_vector;
#endif
#include <vector> // vectors de la STL
#include <functional>
#include "blob.h"
#include "BlobOperators.h"
#include "ComponentLabeling.h"
/**************************************************************************
Filtres / Filters
**************************************************************************/
//! accions que es poden fer amb els filtres
//! Actions performed by a filter (include or exclude blobs)
#define B_INCLUDE 1L
#define B_EXCLUDE 2L
//! condicions sobre els filtres
//! Conditions to apply the filters
#define B_EQUAL 3L
#define B_NOT_EQUAL 4L
#define B_GREATER 5L
#define B_LESS 6L
#define B_GREATER_OR_EQUAL 7L
#define B_LESS_OR_EQUAL 8L
#define B_INSIDE 9L
#define B_OUTSIDE 10L
/**************************************************************************
Excepcions / Exceptions
**************************************************************************/
//! Excepcions llençades per les funcions:
#define EXCEPTION_BLOB_OUT_OF_BOUNDS 1000
#define EXCEPCIO_CALCUL_BLOBS 1001
/**
Classe que conté un conjunt de blobs i permet extreure'n propietats
o filtrar-los segons determinats criteris.
Class to calculate the blobs of an image and calculate some properties
on them. Also, the class provides functions to filter the blobs using
some criteria.
*/
class CBlobResult
{
public:
//! constructor estandard, crea un conjunt buit de blobs
//! Standard constructor, it creates an empty set of blobs
CBlobResult();
//! constructor a partir d'una imatge
//! Image constructor, it creates an object with the blobs of the image
CBlobResult(IplImage *source, IplImage *mask, uchar backgroundColor);
//! constructor de còpia
//! Copy constructor
CBlobResult( const CBlobResult &source );
//! Destructor
virtual ~CBlobResult();
//! operador = per a fer assignacions entre CBlobResult
//! Assigment operator
CBlobResult& operator=(const CBlobResult& source);
//! operador + per concatenar dos CBlobResult
//! Addition operator to concatenate two sets of blobs
CBlobResult operator+( const CBlobResult& source ) const;
//! Afegeix un blob al conjunt
//! Adds a blob to the set of blobs
void AddBlob( CBlob *blob );
#ifdef MATRIXCV_ACTIU
//! Calcula un valor sobre tots els blobs de la classe retornant una MatrixCV
//! Computes some property on all the blobs of the class
double_vector GetResult( funcio_calculBlob *evaluador ) const;
#endif
//! Calcula un valor sobre tots els blobs de la classe retornant un std::vector<double>
//! Computes some property on all the blobs of the class
double_stl_vector GetSTLResult( funcio_calculBlob *evaluador ) const;
//! Calcula un valor sobre un blob de la classe
//! Computes some property on one blob of the class
double GetNumber( int indexblob, funcio_calculBlob *evaluador ) const;
//! Retorna aquells blobs que compleixen les condicions del filtre en el destination
//! Filters the blobs of the class using some property
void Filter(CBlobResult &dst,
int filterAction, funcio_calculBlob *evaluador,
int condition, double lowLimit, double highLimit = 0 );
void Filter(CBlobResult &dst,
int filterAction, funcio_calculBlob *evaluador,
int condition, double lowLimit, double highLimit = 0 ) const;
//! Retorna l'enèssim blob segons un determinat criteri
//! Sorts the blobs of the class acording to some criteria and returns the n-th blob
void GetNthBlob( funcio_calculBlob *criteri, int nBlob, CBlob &dst ) const;
//! Retorna el blob enèssim
//! Gets the n-th blob of the class ( without sorting )
CBlob GetBlob(int indexblob) const;
CBlob *GetBlob(int indexblob);
//! Elimina tots els blobs de l'objecte
//! Clears all the blobs of the class
void ClearBlobs();
//! Escriu els blobs a un fitxer
//! Prints some features of all the blobs in a file
void PrintBlobs( char *nom_fitxer ) const;
//Metodes GET/SET
//! Retorna el total de blobs
//! Gets the total number of blobs
int GetNumBlobs() const
{
return(m_blobs.size());
}
private:
//! Funció per gestionar els errors
//! Function to manage the errors
void RaiseError(const int errorCode) const;
//! Does the Filter method job
void DoFilter(CBlobResult &dst,
int filterAction, funcio_calculBlob *evaluador,
int condition, double lowLimit, double highLimit = 0) const;
protected:
//! Vector amb els blobs
//! Vector with all the blobs
Blob_vector m_blobs;
};
#endif // !defined(_CLASSE_BLOBRESULT_INCLUDED)

View file

@ -1,30 +1,30 @@
#if !defined(_COMPONENT_LABELING_H_INCLUDED)
#define _CLASSE_BLOBRESULT_INCLUDED
#include "vector"
#include "BlobContour.h"
#include "blob.h"
//! definició de que es un vector de blobs
typedef std::vector<CBlob*> Blob_vector;
bool ComponentLabeling( IplImage* inputImage,
IplImage* maskImage,
unsigned char backgroundColor,
Blob_vector &blobs );
void contourTracing( IplImage *image, IplImage *mask, CvPoint contourStart, t_labelType *labels,
bool *visitedPoints, t_labelType label,
bool internalContour, unsigned char backgroundColor,
CBlobContour *currentBlobContour );
CvPoint tracer( IplImage *image, IplImage *mask, CvPoint P, bool *visitedPoints,
short initialMovement,
unsigned char backgroundColor, short &movement );
#endif //!_CLASSE_BLOBRESULT_INCLUDED
#if !defined(_COMPONENT_LABELING_H_INCLUDED)
#define _CLASSE_BLOBRESULT_INCLUDED
#include "vector"
#include "BlobContour.h"
#include "blob.h"
//! definició de que es un vector de blobs
typedef std::vector<CBlob*> Blob_vector;
bool ComponentLabeling( IplImage* inputImage,
IplImage* maskImage,
unsigned char backgroundColor,
Blob_vector &blobs );
void contourTracing( IplImage *image, IplImage *mask, CvPoint contourStart, t_labelType *labels,
bool *visitedPoints, t_labelType label,
bool internalContour, unsigned char backgroundColor,
CBlobContour *currentBlobContour );
CvPoint tracer( IplImage *image, IplImage *mask, CvPoint P, bool *visitedPoints,
short initialMovement,
unsigned char backgroundColor, short &movement );
#endif //!_CLASSE_BLOBRESULT_INCLUDED

View file

@ -1,172 +1,172 @@
/************************************************************************
Blob.h
FUNCIONALITAT: Definició de la classe CBlob
AUTOR: Inspecta S.L.
MODIFICACIONS (Modificació, Autor, Data):
FUNCTIONALITY: Definition of the CBlob class and some helper classes to perform
some calculations on it
AUTHOR: Inspecta S.L.
MODIFICATIONS (Modification, Author, Date):
**************************************************************************/
//! Disable warnings referred to 255 character truncation for the std:map
#pragma warning( disable : 4786 )
#ifndef CBLOB_INSPECTA_INCLUDED
#define CBLOB_INSPECTA_INCLUDED
#include <opencv/cxcore.h>
#include "BlobLibraryConfiguration.h"
#include "BlobContour.h"
#ifdef BLOB_OBJECT_FACTORY
//! Object factory pattern implementation
#include "..\inspecta\DesignPatterns\ObjectFactory.h"
#endif
//! Type of labelled images
typedef unsigned int t_labelType;
//! Blob class
class CBlob
{
typedef std::list<CBlobContour> t_contourList;
public:
CBlob();
CBlob( t_labelType id, CvPoint startPoint, CvSize originalImageSize );
~CBlob();
//! Copy constructor
CBlob( const CBlob &src );
CBlob( const CBlob *src );
//! Operador d'assignació
//! Assigment operator
CBlob& operator=(const CBlob &src );
//! Adds a new internal contour to the blob
void AddInternalContour( const CBlobContour &newContour );
//! Retrieves contour in Freeman's chain code
CBlobContour *GetExternalContour()
{
return &m_externalContour;
}
//! Retrieves blob storage
CvMemStorage *GetStorage()
{
return m_storage;
}
//! Get label ID
t_labelType GetID()
{
return m_id;
}
//! > 0 for extern blobs, 0 if not
int Exterior( IplImage *mask, bool xBorder = true, bool yBorder = true );
//! Compute blob's area
double Area();
//! Compute blob's perimeter
double Perimeter();
//! Compute blob's moment (p,q up to MAX_CALCULATED_MOMENTS)
double Moment(int p, int q);
//! Compute extern perimeter
double ExternPerimeter( IplImage *mask, bool xBorder = true, bool yBorder = true );
//! Get mean grey color
double Mean( IplImage *image );
//! Get standard deviation grey color
double StdDev( IplImage *image );
//! Indica si el blob està buit ( no té cap info associada )
//! Shows if the blob has associated information
bool IsEmpty();
//! Retorna el poligon convex del blob
//! Calculates the convex hull of the blob
t_PointList GetConvexHull();
//! Pinta l'interior d'un blob d'un color determinat
//! Paints the blob in an image
void FillBlob( IplImage *imatge, CvScalar color, int offsetX = 0, int offsetY = 0 );
//! Join a blob to current one (add's contour
void JoinBlob( CBlob *blob );
//! Get bounding box
CvRect GetBoundingBox();
//! Get bounding ellipse
CvBox2D GetEllipse();
//! Minimun X
double MinX()
{
return GetBoundingBox().x;
}
//! Minimun Y
double MinY()
{
return GetBoundingBox().y;
}
//! Maximun X
double MaxX()
{
return GetBoundingBox().x + GetBoundingBox().width;
}
//! Maximun Y
double MaxY()
{
return GetBoundingBox().y + GetBoundingBox().height;
}
private:
//! Deallocates all contours
void ClearContours();
//////////////////////////////////////////////////////////////////////////
// Blob contours
//////////////////////////////////////////////////////////////////////////
//! Contour storage memory
CvMemStorage *m_storage;
//! External contour of the blob (crack codes)
CBlobContour m_externalContour;
//! Internal contours (crack codes)
t_contourList m_internalContours;
//////////////////////////////////////////////////////////////////////////
// Blob features
//////////////////////////////////////////////////////////////////////////
//! Label number
t_labelType m_id;
//! Area
double m_area;
//! Perimeter
double m_perimeter;
//! Extern perimeter from blob
double m_externPerimeter;
//! Mean gray color
double m_meanGray;
//! Standard deviation from gray color blob distribution
double m_stdDevGray;
//! Bounding box
CvRect m_boundingBox;
//! Bounding ellipse
CvBox2D m_ellipse;
//! Sizes from image where blob is extracted
CvSize m_originalImageSize;
};
#endif //CBLOB_INSPECTA_INCLUDED
/************************************************************************
Blob.h
FUNCIONALITAT: Definició de la classe CBlob
AUTOR: Inspecta S.L.
MODIFICACIONS (Modificació, Autor, Data):
FUNCTIONALITY: Definition of the CBlob class and some helper classes to perform
some calculations on it
AUTHOR: Inspecta S.L.
MODIFICATIONS (Modification, Author, Date):
**************************************************************************/
//! Disable warnings referred to 255 character truncation for the std:map
#pragma warning( disable : 4786 )
#ifndef CBLOB_INSPECTA_INCLUDED
#define CBLOB_INSPECTA_INCLUDED
#include <opencv/cxcore.h>
#include "BlobLibraryConfiguration.h"
#include "BlobContour.h"
#ifdef BLOB_OBJECT_FACTORY
//! Object factory pattern implementation
#include "..\inspecta\DesignPatterns\ObjectFactory.h"
#endif
//! Type of labelled images
typedef unsigned int t_labelType;
//! Blob class
class CBlob
{
typedef std::list<CBlobContour> t_contourList;
public:
CBlob();
CBlob( t_labelType id, CvPoint startPoint, CvSize originalImageSize );
~CBlob();
//! Copy constructor
CBlob( const CBlob &src );
CBlob( const CBlob *src );
//! Operador d'assignació
//! Assigment operator
CBlob& operator=(const CBlob &src );
//! Adds a new internal contour to the blob
void AddInternalContour( const CBlobContour &newContour );
//! Retrieves contour in Freeman's chain code
CBlobContour *GetExternalContour()
{
return &m_externalContour;
}
//! Retrieves blob storage
CvMemStorage *GetStorage()
{
return m_storage;
}
//! Get label ID
t_labelType GetID()
{
return m_id;
}
//! > 0 for extern blobs, 0 if not
int Exterior( IplImage *mask, bool xBorder = true, bool yBorder = true );
//! Compute blob's area
double Area();
//! Compute blob's perimeter
double Perimeter();
//! Compute blob's moment (p,q up to MAX_CALCULATED_MOMENTS)
double Moment(int p, int q);
//! Compute extern perimeter
double ExternPerimeter( IplImage *mask, bool xBorder = true, bool yBorder = true );
//! Get mean grey color
double Mean( IplImage *image );
//! Get standard deviation grey color
double StdDev( IplImage *image );
//! Indica si el blob està buit ( no té cap info associada )
//! Shows if the blob has associated information
bool IsEmpty();
//! Retorna el poligon convex del blob
//! Calculates the convex hull of the blob
t_PointList GetConvexHull();
//! Pinta l'interior d'un blob d'un color determinat
//! Paints the blob in an image
void FillBlob( IplImage *imatge, CvScalar color, int offsetX = 0, int offsetY = 0 );
//! Join a blob to current one (add's contour
void JoinBlob( CBlob *blob );
//! Get bounding box
CvRect GetBoundingBox();
//! Get bounding ellipse
CvBox2D GetEllipse();
//! Minimun X
double MinX()
{
return GetBoundingBox().x;
}
//! Minimun Y
double MinY()
{
return GetBoundingBox().y;
}
//! Maximun X
double MaxX()
{
return GetBoundingBox().x + GetBoundingBox().width;
}
//! Maximun Y
double MaxY()
{
return GetBoundingBox().y + GetBoundingBox().height;
}
private:
//! Deallocates all contours
void ClearContours();
//////////////////////////////////////////////////////////////////////////
// Blob contours
//////////////////////////////////////////////////////////////////////////
//! Contour storage memory
CvMemStorage *m_storage;
//! External contour of the blob (crack codes)
CBlobContour m_externalContour;
//! Internal contours (crack codes)
t_contourList m_internalContours;
//////////////////////////////////////////////////////////////////////////
// Blob features
//////////////////////////////////////////////////////////////////////////
//! Label number
t_labelType m_id;
//! Area
double m_area;
//! Perimeter
double m_perimeter;
//! Extern perimeter from blob
double m_externPerimeter;
//! Mean gray color
double m_meanGray;
//! Standard deviation from gray color blob distribution
double m_stdDevGray;
//! Bounding box
CvRect m_boundingBox;
//! Bounding ellipse
CvBox2D m_ellipse;
//! Sizes from image where blob is extracted
CvSize m_originalImageSize;
};
#endif //CBLOB_INSPECTA_INCLUDED

View file

@ -43,8 +43,8 @@
#ifndef __OPENCV_CALIB3D_HPP__
#define __OPENCV_CALIB3D_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/features2d/features2d.hpp"
#ifdef __cplusplus
extern "C" {

View file

@ -43,10 +43,10 @@
#ifndef __OPENCV_CONTRIB_HPP__
#define __OPENCV_CONTRIB_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/imgproc/imgproc.hpp"
#include "OpenCV/Headers/features2d/features2d.hpp"
#include "OpenCV/Headers/objdetect/objdetect.hpp"
#ifdef __cplusplus
@ -976,9 +976,9 @@ namespace cv
CV_EXPORTS bool initModule_contrib();
}
#include "opencv2/contrib/retina.hpp"
#include "OpenCV/Headers/contrib/retina.hpp"
#include "opencv2/contrib/openfabmap.hpp"
#include "OpenCV/Headers/contrib/openfabmap.hpp"
#endif

View file

@ -43,12 +43,12 @@
#ifndef __OPENCV_HYBRIDTRACKER_H_
#define __OPENCV_HYBRIDTRACKER_H_
#include "opencv2/core/core.hpp"
#include "opencv2/core/operations.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/ml/ml.hpp"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/core/operations.hpp"
#include "OpenCV/Headers/imgproc/imgproc.hpp"
#include "OpenCV/Headers/features2d/features2d.hpp"
#include "OpenCV/Headers/video/tracking.hpp"
#include "OpenCV/Headers/ml/ml.hpp"
#ifdef __cplusplus

View file

@ -52,8 +52,8 @@
#ifndef __OPENCV_OPENFABMAP_H_
#define __OPENCV_OPENFABMAP_H_
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/features2d/features2d.hpp"
#include <vector>
#include <list>

View file

@ -72,7 +72,7 @@
* Author: Alexandre Benoit
*/
#include "opencv2/core/core.hpp" // for all OpenCV core functionalities access, including cv::Exception support
#include "OpenCV/Headers/core/core.hpp" // for all OpenCV core functionalities access, including cv::Exception support
#include <valarray>
namespace cv

View file

@ -46,8 +46,8 @@
#ifndef __OPENCV_CORE_HPP__
#define __OPENCV_CORE_HPP__
#include "opencv2/core/types_c.h"
#include "opencv2/core/version.hpp"
#include "OpenCV/Headers/core/types_c.h"
#include "OpenCV/Headers/core/version.hpp"
#ifdef __cplusplus
@ -4732,7 +4732,7 @@ protected:
#endif // __cplusplus
#include "opencv2/core/operations.hpp"
#include "opencv2/core/mat.hpp"
#include "OpenCV/Headers/core/operations.hpp"
#include "OpenCV/Headers/core/mat.hpp"
#endif /*__OPENCV_CORE_HPP__*/

View file

@ -44,7 +44,7 @@
#ifndef __OPENCV_CORE_C_H__
#define __OPENCV_CORE_C_H__
#include "opencv2/core/types_c.h"
#include "OpenCV/Headers/core/types_c.h"
#ifdef __cplusplus
extern "C" {

View file

@ -40,4 +40,4 @@
//
//M*/
#include "opencv2/core/cuda_devptrs.hpp"
#include "OpenCV/Headers/core/cuda_devptrs.hpp"

View file

@ -45,8 +45,8 @@
#ifdef __cplusplus
#include "opencv2/core/core_c.h"
#include "opencv2/core/core.hpp"
#include "OpenCV/Headers/core/core_c.h"
#include "OpenCV/Headers/core/core.hpp"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4714 ) //__forceinline is not inlined

View file

@ -45,8 +45,8 @@
#ifdef __cplusplus
#include "opencv2/core/core.hpp"
#include "opencv2/core/cuda_devptrs.hpp"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/core/cuda_devptrs.hpp"
namespace cv { namespace gpu
{

View file

@ -181,7 +181,7 @@ CV_INLINE IppiSize ippiSize(int width, int height)
# pragma GCC diagnostic ignored "-Wshadow"
# endif
# include <Eigen/Core>
# include "opencv2/core/eigen.hpp"
# include "OpenCV/Headers/core/eigen.hpp"
#endif
#ifdef __cplusplus

View file

@ -45,7 +45,7 @@
#ifdef __cplusplus
#include "opencv2/core/core.hpp"
#include "OpenCV/Headers/core/core.hpp"
namespace cv
{

View file

@ -100,7 +100,7 @@
#ifndef __OPENCV_CORE_WIMAGE_HPP__
#define __OPENCV_CORE_WIMAGE_HPP__
#include "opencv2/core/core_c.h"
#include "OpenCV/Headers/core/core_c.h"
#ifdef __cplusplus

View file

@ -43,8 +43,8 @@
#ifndef __OPENCV_FEATURES_2D_HPP__
#define __OPENCV_FEATURES_2D_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/flann/miniflann.hpp"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/flann/miniflann.hpp"
#ifdef __cplusplus
#include <limits>

View file

@ -45,10 +45,10 @@
#ifdef __cplusplus
#include "opencv2/core/types_c.h"
#include "opencv2/core/core.hpp"
#include "opencv2/flann/flann_base.hpp"
#include "opencv2/flann/miniflann.hpp"
#include "OpenCV/Headers/core/types_c.h"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/flann/flann_base.hpp"
#include "OpenCV/Headers/flann/miniflann.hpp"
namespace cvflann
{

View file

@ -45,8 +45,8 @@
#ifdef __cplusplus
#include "opencv2/core/core.hpp"
#include "opencv2/flann/defines.h"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/flann/defines.h"
namespace cv
{

View file

@ -44,7 +44,7 @@
#define __OPENCV_GPU_COMMON_HPP__
#include <cuda_runtime.h>
#include "opencv2/core/cuda_devptrs.hpp"
#include "OpenCV/Headers/core/cuda_devptrs.hpp"
#ifndef CV_PI
#define CV_PI 3.1415926535897932384626433832795

View file

@ -40,4 +40,4 @@
//
//M*/
#include "opencv2/core/cuda_devptrs.hpp"
#include "OpenCV/Headers/core/cuda_devptrs.hpp"

View file

@ -49,10 +49,10 @@
#include <iosfwd>
#endif
#include "opencv2/core/gpumat.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "OpenCV/Headers/core/gpumat.hpp"
#include "OpenCV/Headers/imgproc/imgproc.hpp"
#include "OpenCV/Headers/objdetect/objdetect.hpp"
#include "OpenCV/Headers/features2d/features2d.hpp"
namespace cv { namespace gpu {

View file

@ -40,4 +40,4 @@
//
//M*/
#include "opencv2/core/gpumat.hpp"
#include "OpenCV/Headers/core/gpumat.hpp"

View file

@ -43,7 +43,7 @@
#ifndef __OPENCV_GPU_STREAM_ACCESSOR_HPP__
#define __OPENCV_GPU_STREAM_ACCESSOR_HPP__
#include "opencv2/gpu/gpu.hpp"
#include "OpenCV/Headers/gpu/gpu.hpp"
#include "cuda_runtime_api.h"
namespace cv

View file

@ -32,7 +32,7 @@
#import <Accelerate/Accelerate.h>
#import <AVFoundation/AVFoundation.h>
#import <ImageIO/ImageIO.h>
#include "opencv2/core/core.hpp"
#include "OpenCV/Headers/core/core.hpp"
/////////////////////////////////////// CvAbstractCamera /////////////////////////////////////

View file

@ -43,8 +43,8 @@
#ifndef __OPENCV_HIGHGUI_HPP__
#define __OPENCV_HIGHGUI_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "OpenCV/Headers/core/core.hpp"
#include "OpenCV/Headers/highgui/highgui_c.h"
#ifdef __cplusplus

Some files were not shown because too many files have changed in this diff Show more