diff --git a/Src/Model/TrackingAlgorithm/NN2dMapper.h b/Src/Model/TrackingAlgorithm/NN2dMapper.h
index f55174941bea97e6099f8b9e92fe286b7d9501b1..9851c6338fbe53ed6fcb629929f09d1e5e6b1705 100644
--- a/Src/Model/TrackingAlgorithm/NN2dMapper.h
+++ b/Src/Model/TrackingAlgorithm/NN2dMapper.h
@@ -1,8 +1,10 @@
 #pragma once
 
-#include <cv.h>
-#include <highgui.h>
 #include <chrono>
+
+#include <opencv2/opencv.hpp>
+#include <opencv2/highgui.hpp>
+
 #include "../TrackedComponents/pose/FishPose.h"
 #include "../TrackedComponents/TrackedElement.h"
 #include "../TrackedComponents/TrackedTrajectory.h"
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.cpp
index 7ea09b3e311bfa04e6da01818314680c60bd2b0b..c2a0cbcd0d13cc74d321780d90ad8cbdc8431e2e 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.cpp
@@ -1,5 +1,7 @@
 #include "BlobContour.h"
 
+#include <opencv2/imgproc/imgproc_c.h>
+
 CBlobContour::CBlobContour()
 {
 	m_startPoint.x = 0;
@@ -11,7 +13,8 @@ CBlobContour::CBlobContour()
 	m_contour = NULL;
 	m_parentStorage = NULL;
 }
-CBlobContour::CBlobContour(CvPoint startPoint, CvMemStorage *storage )
+
+CBlobContour::CBlobContour(cv::Point startPoint, CvMemStorage *storage )
 {
 	m_startPoint.x = startPoint.x;
 	m_startPoint.y = startPoint.y;
@@ -83,17 +86,17 @@ CBlobContour& CBlobContour::operator=( const CBlobContour &source )
 
 
 /**
-- FUNCI�: AddChainCode
+- FUNCI�: AddChainCode
 - FUNCIONALITAT: Add chain code to contour
-- PAR�METRES:
+- PAR�METRES:
 	- 
 - RESULTAT:
 	- 
 - RESTRICCIONS:
 	- 
 - AUTOR: rborras
-- DATA DE CREACI�: 2008/05/06
-- MODIFICACI�: Data. Autor. Descripci�.
+- DATA DE CREACI�: 2008/05/06
+- MODIFICACI�: Data. Autor. Descripci�.
 */
 void CBlobContour::AddChainCode(t_chainCode chaincode)
 {
@@ -116,17 +119,17 @@ void CBlobContour::ResetChainCode()
 }
 
 /**
-- FUNCI�: GetPerimeter
+- FUNCI�: GetPerimeter
 - FUNCIONALITAT: Get perimeter from chain code. Diagonals sum sqrt(2) and horizontal and vertical codes 1
-- PAR�METRES:
+- PAR�METRES:
 	- 
 - RESULTAT:
 	- 
 - RESTRICCIONS:
 	- 
 - AUTOR: rborras
-- DATA DE CREACI�: 2008/04/30
-- MODIFICACI�: Data. Autor. Descripci�.
+- DATA DE CREACI�: 2008/04/30
+- MODIFICACI�: Data. Autor. Descripci�.
 - NOTA: Algorithm derived from "Methods to estimate area and perimeters of blob-like objects: A comparison", L.Yang
 */
 double CBlobContour::GetPerimeter()
@@ -146,17 +149,17 @@ double CBlobContour::GetPerimeter()
 }
 
 /**
-- FUNCI�: GetArea
+- FUNCI�: GetArea
 - FUNCIONALITAT: Computes area from chain code
-- PAR�METRES:
+- PAR�METRES:
 	- 
 - RESULTAT:
 	- May give negative areas for clock wise contours
 - RESTRICCIONS:
 	- 
 - AUTOR: rborras
-- DATA DE CREACI�: 2008/04/30
-- MODIFICACI�: Data. Autor. Descripci�.
+- DATA DE CREACI�: 2008/04/30
+- MODIFICACI�: Data. Autor. Descripci�.
 - NOTA: Algorithm derived from "Properties of contour codes", G.R. Wilson
 */
 double CBlobContour::GetArea()
@@ -213,7 +216,7 @@ t_PointList CBlobContour::GetContourPoints()
 	CvSeq *tmpPoints;
 	CvSeqReader reader;
 	CvSeqWriter writer;
-	CvPoint actualPoint;
+	cv::Point actualPoint;
 	CvRect boundingBox;
 
 	// if aproximation is different than simple extern perimeter will not work
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.h b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.h
index b7fbcd7d95cb79f5d36aa1472481eff9d1ee9cec..83d2eb97dd327b2e46230c752b371243e55ba464 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.h
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobContour.h
@@ -1,11 +1,9 @@
 #ifndef BLOBCONTOUR_H_INCLUDED
 #define BLOBCONTOUR_H_INCLUDED
 
-
-#include "list"
-#include <opencv/cv.h>
-//#include "cxtypes.h"  //AO
-#include <opencv/cxcore.h>   //
+#include <opencv2/opencv.hpp>
+#include <opencv2/core/types_c.h>
+#include <opencv2/imgproc/types_c.h>
 
 //! Type of chain codes
 typedef unsigned char t_chainCode;
@@ -28,7 +26,7 @@ class CBlobContour
 public:
 	//! Constructors
 	CBlobContour();
-	CBlobContour(CvPoint startPoint, CvMemStorage *storage );
+	CBlobContour(cv::Point startPoint, CvMemStorage *storage );
 	//! Copy constructor
 	CBlobContour( CBlobContour *source );
 
@@ -55,7 +53,7 @@ public:
 
 protected:	
 
-	CvPoint GetStartPoint() const
+	cv::Point GetStartPoint() const
 	{
 		return m_startPoint;
 	}
@@ -77,7 +75,7 @@ protected:
 
 private:
 	//! Starting point of the contour
-	CvPoint m_startPoint;
+	cv::Point m_startPoint;
 	//! All points from the contour
 	t_PointList m_contourPoints;
 
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobLibraryConfiguration.h b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobLibraryConfiguration.h
index 55fd8a9ff7dd4931587e2c7f5597e50782f3e4a2..f1a02a7393f9a313c08c5c11e0ca3c932144a174 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobLibraryConfiguration.h
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobLibraryConfiguration.h
@@ -1,22 +1,12 @@
 /************************************************************************
   			BlobLibraryConfiguration.h
   			
-FUNCIONALITAT: Configuraci� del comportament global de la llibreria
+FUNCIONALITAT: Configuraci� del comportament global de la llibreria
 AUTOR: Inspecta S.L.
-MODIFICACIONS (Modificaci�, Autor, Data):
+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.
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.cpp
index 2974547ad5365624f5bc5cd5a6abb763da6ba3ce..cfdae2d425d7461a8804373847415e5365a71581 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.cpp
@@ -1,8 +1,11 @@
 #include <limits.h>
+
 #include "BlobOperators.h"
 
+#include <opencv2/imgproc/imgproc_c.h>
+
 /***************************************************************************
-  Implementaci� de les classes per al c�lcul de caracter�stiques sobre el blob
+  Implementaci� de les classes per al c�lcul de caracter�stiques sobre el blob
 
   Implementation of the helper classes to perform operations on blobs
 /**************************************************************************/
@@ -15,7 +18,7 @@
 	- returns the pq moment or 0 if the moment it is not implemented
 - RESTRICTIONS:
 	- Currently, implemented moments up to 3
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 20-07-2004.
 - MODIFICATION: Date. Author. Description.
 */
@@ -25,19 +28,19 @@ double CBlobGetMoment::operator()(CBlob &blob)
 }
 
 /**
-- FUNCI�: HullPerimeter
+- FUNCI�: HullPerimeter
 - FUNCIONALITAT: Calcula la longitud del perimetre convex del blob.
-			   Fa servir la funci� d'OpenCV cvConvexHull2 per a 
+			   Fa servir la funci� d'OpenCV cvConvexHull2 per a 
 			   calcular el perimetre convex.
 			   
-- PAR�METRES:
+- PAR�METRES:
 - RESULTAT:
-	- retorna la longitud del per�metre convex del blob. Si el blob no t� coordenades
-	  associades retorna el per�metre normal del blob.
+	- retorna la longitud del per�metre convex del blob. Si el blob no t� coordenades
+	  associades retorna el per�metre normal del blob.
 - RESTRICCIONS:
-- AUTOR: Ricard Borr�s
-- DATA DE CREACI�: 20-07-2004.
-- MODIFICACI�: Data. Autor. Descripci�.
+- AUTOR: Ricard Borr�s
+- DATA DE CREACI�: 20-07-2004.
+- MODIFICACI�: Data. Autor. Descripci�.
 */
 /**
 - FUNCTION: CBlobGetHullPerimeter
@@ -47,7 +50,7 @@ double CBlobGetMoment::operator()(CBlob &blob)
 	- returns the convex hull perimeter of the blob or the perimeter if the 
 	blob edges could not be retrieved
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -91,7 +94,7 @@ double CBlobGetHullArea::operator()(CBlob &blob)
 - PARAMETERS:
 - RESULT:
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -100,7 +103,7 @@ double CBlobGetMinXatMinY::operator()(CBlob &blob)
 	double result = LONG_MAX;
 	
 	CvSeqReader reader;
-	CvPoint actualPoint;
+	cv::Point actualPoint;
 	t_PointList externContour;
 	
 	externContour = blob.GetExternalContour()->GetContourPoints();
@@ -126,7 +129,7 @@ double CBlobGetMinXatMinY::operator()(CBlob &blob)
 - PARAMETERS:
 - RESULT:
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -135,7 +138,7 @@ double CBlobGetMinYatMaxX::operator()(CBlob &blob)
 	double result = LONG_MAX;
 	
 	CvSeqReader reader;
-	CvPoint actualPoint;
+	cv::Point actualPoint;
 	t_PointList externContour;
 	
 	externContour = blob.GetExternalContour()->GetContourPoints();
@@ -161,7 +164,7 @@ double CBlobGetMinYatMaxX::operator()(CBlob &blob)
 - PARAMETERS:
 - RESULT:
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -170,7 +173,7 @@ double CBlobGetMaxXatMaxY::operator()(CBlob &blob)
 	double result = LONG_MIN;
 	
 	CvSeqReader reader;
-	CvPoint actualPoint;
+	cv::Point actualPoint;
 	t_PointList externContour;
 	
 	externContour = blob.GetExternalContour()->GetContourPoints();
@@ -197,7 +200,7 @@ double CBlobGetMaxXatMaxY::operator()(CBlob &blob)
 - PARAMETERS:
 - RESULT:
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -206,7 +209,7 @@ double CBlobGetMaxYatMinX::operator()(CBlob &blob)
 	double result = LONG_MIN;
 	
 	CvSeqReader reader;
-	CvPoint actualPoint;
+	cv::Point actualPoint;
 	t_PointList externContour;
 	
 	externContour = blob.GetExternalContour()->GetContourPoints();
@@ -236,7 +239,7 @@ double CBlobGetMaxYatMinX::operator()(CBlob &blob)
 - RESULT:
 - RESTRICTIONS:
 	- See below to see how the lenght and the breadth are aproximated
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -250,7 +253,7 @@ double CBlobGetElongation::operator()(CBlob &blob)
 
 	if( tmp > 0.0 )
 		ampladaC = (double) (blob.Perimeter()+sqrt(tmp))/4;
-	// error intr�nsec en els c�lculs de l'�rea i el per�metre 
+	// error intr�nsec en els c�lculs de l'�rea i el per�metre 
 	else
 		ampladaC = (double) (blob.Perimeter())/4;
 
@@ -273,7 +276,7 @@ double CBlobGetElongation::operator()(CBlob &blob)
 - PARAMETERS:
 - RESULT:
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -295,7 +298,7 @@ double CBlobGetCompactness::operator()(CBlob &blob)
 - PARAMETERS:
 - RESULT:
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -321,7 +324,7 @@ double CBlobGetRoughness::operator()(CBlob &blob)
 - RESULT:
 - RESTRICTIONS:
 	- The lenght is an aproximation to the real lenght
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -334,7 +337,7 @@ double CBlobGetLength::operator()(CBlob &blob)
 
 	if( tmp > 0.0 )
 		ampladaC = (double) (blob.Perimeter()+sqrt(tmp))/4;
-	// error intr�nsec en els c�lculs de l'�rea i el per�metre 
+	// error intr�nsec en els c�lculs de l'�rea i el per�metre 
 	else
 		ampladaC = (double) (blob.Perimeter())/4;
 
@@ -354,7 +357,7 @@ double CBlobGetLength::operator()(CBlob &blob)
 - RESULT:
 - RESTRICTIONS:
 	- The breadth is an aproximation to the real breadth
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -367,7 +370,7 @@ double CBlobGetBreadth::operator()(CBlob &blob)
 
 	if( tmp > 0.0 )
 		ampladaC = (double) (blob.Perimeter()+sqrt(tmp))/4;
-	// error intr�nsec en els c�lculs de l'�rea i el per�metre 
+	// error intr�nsec en els c�lculs de l'�rea i el per�metre 
 	else
 		ampladaC = (double) (blob.Perimeter())/4;
 
@@ -378,7 +381,7 @@ double CBlobGetBreadth::operator()(CBlob &blob)
 }
 
 /**
-	Calcula la dist�ncia entre un punt i el centre del blob
+	Calcula la dist�ncia entre un punt i el centre del blob
 */
 /**
 - FUNCTION: CBlobGetDistanceFromPoint
@@ -387,7 +390,7 @@ double CBlobGetBreadth::operator()(CBlob &blob)
 - PARAMETERS:
 - RESULT:
 - RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
+- AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
@@ -424,79 +427,3 @@ double CBlobGetXYInside::operator()(CBlob &blob)
 
 	return 0;
 }
-#ifdef BLOB_OBJECT_FACTORY
-
-/**
-- FUNCI�: RegistraTotsOperadors
-- FUNCIONALITAT: Registrar tots els operadors definits a blob.h
-- PAR�METRES:
-	- fabricaOperadorsBlob: f�brica on es registraran els operadors
-- RESULTAT:
-	- Modifica l'objecte fabricaOperadorsBlob
-- RESTRICCIONS:
-	- Nom�s es registraran els operadors de blob.h. Si se'n volen afegir, cal afegir-los amb 
-	  el m�tode Register de la f�brica.
-- AUTOR: rborras
-- DATA DE CREACI�: 2006/05/18
-- MODIFICACI�: Data. Autor. Descripci�.
-*/
-void RegistraTotsOperadors( t_OperadorBlobFactory &fabricaOperadorsBlob )
-{
-	// blob shape
-	fabricaOperadorsBlob.Register( CBlobGetArea().GetNom(), Type2Type<CBlobGetArea>());
-	fabricaOperadorsBlob.Register( CBlobGetBreadth().GetNom(), Type2Type<CBlobGetBreadth>());
-	fabricaOperadorsBlob.Register( CBlobGetCompactness().GetNom(), Type2Type<CBlobGetCompactness>());
-	fabricaOperadorsBlob.Register( CBlobGetElongation().GetNom(), Type2Type<CBlobGetElongation>());
-	fabricaOperadorsBlob.Register( CBlobGetExterior().GetNom(), Type2Type<CBlobGetExterior>());
-	fabricaOperadorsBlob.Register( CBlobGetLength().GetNom(), Type2Type<CBlobGetLength>());
-	fabricaOperadorsBlob.Register( CBlobGetPerimeter().GetNom(), Type2Type<CBlobGetPerimeter>());
-	fabricaOperadorsBlob.Register( CBlobGetRoughness().GetNom(), Type2Type<CBlobGetRoughness>());
-
-	// blob color
-	fabricaOperadorsBlob.Register( CBlobGetMean(NULL).GetNom(), Type2Type<CBlobGetMean>());
-	fabricaOperadorsBlob.Register( CBlobGetStdDev(NULL).GetNom(), Type2Type<CBlobGetStdDev>());
-
-	// extern pixels
-	fabricaOperadorsBlob.Register( CBlobGetExternPerimeterRatio().GetNom(), Type2Type<CBlobGetExternPerimeterRatio>());
-	fabricaOperadorsBlob.Register( CBlobGetExternHullPerimeterRatio().GetNom(), Type2Type<CBlobGetExternHullPerimeterRatio>());
-	fabricaOperadorsBlob.Register( CBlobGetExternPerimeter().GetNom(), Type2Type<CBlobGetExternPerimeter>());
-	
-
-	// hull 
-	fabricaOperadorsBlob.Register( CBlobGetHullPerimeter().GetNom(), Type2Type<CBlobGetHullPerimeter>());
-	fabricaOperadorsBlob.Register( CBlobGetHullArea().GetNom(), Type2Type<CBlobGetHullArea>());
-	
-
-	// elipse info
-	fabricaOperadorsBlob.Register( CBlobGetMajorAxisLength().GetNom(), Type2Type<CBlobGetMajorAxisLength>());
-	fabricaOperadorsBlob.Register( CBlobGetMinorAxisLength().GetNom(), Type2Type<CBlobGetMinorAxisLength>());
-	fabricaOperadorsBlob.Register( CBlobGetAxisRatio().GetNom(), Type2Type<CBlobGetAxisRatio>());
-	fabricaOperadorsBlob.Register( CBlobGetOrientation().GetNom(), Type2Type<CBlobGetOrientation>());
-	fabricaOperadorsBlob.Register( CBlobGetOrientationCos().GetNom(), Type2Type<CBlobGetOrientationCos>());
-	fabricaOperadorsBlob.Register( CBlobGetAreaElipseRatio().GetNom(), Type2Type<CBlobGetAreaElipseRatio>());
-
-	// min an max
-	fabricaOperadorsBlob.Register( CBlobGetMaxX().GetNom(), Type2Type<CBlobGetMaxX>());
-	fabricaOperadorsBlob.Register( CBlobGetMaxY().GetNom(), Type2Type<CBlobGetMaxY>());
-	fabricaOperadorsBlob.Register( CBlobGetMinX().GetNom(), Type2Type<CBlobGetMinX>());
-	fabricaOperadorsBlob.Register( CBlobGetMinY().GetNom(), Type2Type<CBlobGetMinY>());
-
-	fabricaOperadorsBlob.Register( CBlobGetMaxXatMaxY().GetNom(), Type2Type<CBlobGetMaxXatMaxY>());
-	fabricaOperadorsBlob.Register( CBlobGetMaxYatMinX().GetNom(), Type2Type<CBlobGetMaxYatMinX>());
-	fabricaOperadorsBlob.Register( CBlobGetMinXatMinY().GetNom(), Type2Type<CBlobGetMinXatMinY>());
-	fabricaOperadorsBlob.Register( CBlobGetMinYatMaxX().GetNom(), Type2Type<CBlobGetMinYatMaxX>());
-
-	// coordinate info
-	fabricaOperadorsBlob.Register( CBlobGetXYInside().GetNom(), Type2Type<CBlobGetXYInside>());
-	fabricaOperadorsBlob.Register( CBlobGetDiffY().GetNom(), Type2Type<CBlobGetDiffY>());
-	fabricaOperadorsBlob.Register( CBlobGetDiffX().GetNom(), Type2Type<CBlobGetDiffX>());
-	fabricaOperadorsBlob.Register( CBlobGetXCenter().GetNom(), Type2Type<CBlobGetXCenter>());
-	fabricaOperadorsBlob.Register( CBlobGetYCenter().GetNom(), Type2Type<CBlobGetYCenter>());
-	fabricaOperadorsBlob.Register( CBlobGetDistanceFromPoint().GetNom(), Type2Type<CBlobGetDistanceFromPoint>());
-
-	// moments
-	fabricaOperadorsBlob.Register( CBlobGetMoment().GetNom(), Type2Type<CBlobGetMoment>());
-
-}
-
-#endif	//BLOB_OBJECT_FACTORY
\ No newline at end of file
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.h b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.h
index 4fbc1c810613ca2f434af37d7ea25a0bae5b9c9d..fbe233fdb49354da62c97f04a10f6e0140a26b0f 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.h
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobOperators.h
@@ -4,12 +4,12 @@
 #include "blob.h"
 
 /**************************************************************************
-		Definici� de les classes per a fer operacions sobre els blobs
+		Definici� de les classes per a fer operacions sobre els blobs
 
 		Helper classes to perform operations on blobs
 **************************************************************************/
 
-//! Factor de conversi� de graus a radians
+//! Factor de conversi� de graus a radians
 #define DEGREE2RAD		(CV_PI / 180.0)
 
 
@@ -33,26 +33,6 @@ public:
 
 typedef COperadorBlob funcio_calculBlob;
 
-#ifdef BLOB_OBJECT_FACTORY
-	/**
-		Funci� per comparar dos identificadors dins de la f�brica de COperadorBlobs
-	*/
-	struct functorComparacioIdOperador
-	{
-	  bool operator()(const char* s1, const char* s2) const
-	  {
-		return strcmp(s1, s2) < 0;
-	  }
-	};
-
-	//! Definition of Object factory type for COperadorBlob objects
-	typedef ObjectFactory<COperadorBlob, const char *, functorComparacioIdOperador > t_OperadorBlobFactory;
-
-	//! Funci� global per a registrar tots els operadors definits a blob.h
-	void RegistraTotsOperadors( t_OperadorBlobFactory &fabricaOperadorsBlob );
-
-#endif
-
 
 //! Classe per calcular l'etiqueta d'un blob
 //! Class to get ID of a blob
@@ -70,7 +50,7 @@ public:
 };
 
 
-//! Classe per calcular l'�rea d'un blob
+//! Classe per calcular l'�rea d'un blob
 //! Class to get the area of a blob
 class CBlobGetArea : public COperadorBlob
 {
@@ -100,7 +80,7 @@ public:
 	}
 };
 
-//! Classe que diu si un blob �s extern o no
+//! Classe que diu si un blob �s extern o no
 //! Class to get the extern flag of a blob
 class CBlobGetExterior: public COperadorBlob
 {
@@ -157,7 +137,7 @@ private:
 	IplImage *m_image;
 };
 
-//! Classe per calcular la desviaci� est�ndard dels nivells de gris d'un blob
+//! Classe per calcular la desviaci� est�ndard dels nivells de gris d'un blob
 //! Class to get the standard deviation of the grey level values of a blob
 class CBlobGetStdDev: public COperadorBlob
 {
@@ -220,7 +200,7 @@ public:
 	}
 };
 
-//! Classe per calcular la difer�ncia en X del blob
+//! Classe per calcular la difer�ncia en X del blob
 class CBlobGetDiffX: public COperadorBlob
 {
 public:
@@ -234,7 +214,7 @@ public:
 	}
 };
 
-//! Classe per calcular la difer�ncia en X del blob
+//! Classe per calcular la difer�ncia en X del blob
 class CBlobGetDiffY: public COperadorBlob
 {
 public:
@@ -253,7 +233,7 @@ public:
 class CBlobGetMoment: public COperadorBlob
 {
 public:
-	//! Constructor est�ndard
+	//! Constructor est�ndard
 	//! Standard constructor (gets the 00 moment)
 	CBlobGetMoment()
 	{
@@ -289,7 +269,7 @@ public:
 	}
 };
 
-//! Classe per calcular l'�rea del poligon convex d'un blob
+//! Classe per calcular l'�rea del poligon convex d'un blob
 //! Class to calculate the convex hull area of a blob
 class CBlobGetHullArea: public COperadorBlob
 {
@@ -349,7 +329,7 @@ public:
 	}
 };
 
-//! Classe per a calcular la x m�nima
+//! Classe per a calcular la x m�nima
 //! Class to get the minimum x
 class CBlobGetMinX: public COperadorBlob
 {
@@ -364,7 +344,7 @@ public:
 	}
 };
 
-//! Classe per a calcular la x m�xima
+//! Classe per a calcular la x m�xima
 //! Class to get the maximum x
 class CBlobGetMaxX: public COperadorBlob
 {
@@ -379,7 +359,7 @@ public:
 	}
 };
 
-//! Classe per a calcular la y m�nima
+//! Classe per a calcular la y m�nima
 //! Class to get the minimum y
 class CBlobGetMinY: public COperadorBlob
 {
@@ -394,7 +374,7 @@ public:
 	}
 };
 
-//! Classe per a calcular la y m�xima
+//! Classe per a calcular la y m�xima
 //! Class to get the maximum y
 class CBlobGetMaxY: public COperadorBlob
 {
@@ -434,7 +414,7 @@ public:
 	}
 };
 
-//! Classe per calcular la dist�ncia entre el centre del blob i un punt donat
+//! Classe per calcular la dist�ncia entre el centre del blob i un punt donat
 //! Class to calculate the euclidean distance between the center of a blob and a given point
 class CBlobGetDistanceFromPoint: public COperadorBlob
 {
@@ -458,7 +438,7 @@ public:
 	}
 
 private:
-	// coordenades del punt on volem calcular la dist�ncia
+	// coordenades del punt on volem calcular la dist�ncia
 	double m_x, m_y;
 };
 
@@ -493,8 +473,8 @@ private:
 };
 
 //! Classe per calcular el ratio entre el perimetre i nombre pixels externs
-//! valors propers a 0 indiquen que la majoria del blob �s intern
-//! valors propers a 1 indiquen que la majoria del blob �s extern
+//! valors propers a 0 indiquen que la majoria del blob �s intern
+//! valors propers a 1 indiquen que la majoria del blob �s extern
 //! Class to calculate the ratio between the perimeter and the number of extern pixels
 class CBlobGetExternPerimeterRatio: public COperadorBlob
 {
@@ -528,8 +508,8 @@ private:
 };
 
 //! Classe per calcular el ratio entre el perimetre convex i nombre pixels externs
-//! valors propers a 0 indiquen que la majoria del blob �s intern
-//! valors propers a 1 indiquen que la majoria del blob �s extern
+//! valors propers a 0 indiquen que la majoria del blob �s intern
+//! valors propers a 1 indiquen que la majoria del blob �s extern
 //! Class to calculate the ratio between the perimeter and the number of extern pixels
 class CBlobGetExternHullPerimeterRatio: public COperadorBlob
 {
@@ -656,7 +636,7 @@ public:
 	}
 };
 
-//! Classe per calcular l'orientaci� de l'ellipse del blob en radians
+//! Classe per calcular l'orientaci� de l'ellipse del blob en radians
 //! Class to calculate the orientation of the ellipse that fits the blob edges in radians
 class CBlobGetOrientation: public COperadorBlob
 {
@@ -678,7 +658,7 @@ public:
 	}
 };
 
-//! Classe per calcular el cosinus de l'orientaci� de l'ellipse del blob
+//! Classe per calcular el cosinus de l'orientaci� de l'ellipse del blob
 //! Class to calculate the cosinus of the orientation of the ellipse that fits the blob edges
 class CBlobGetOrientationCos: public COperadorBlob
 {
@@ -695,7 +675,7 @@ public:
 };
 
 
-//! Classe per calcular el ratio entre l'eix major i menor de la el�lipse
+//! Classe per calcular el ratio entre l'eix major i menor de la el�lipse
 //! Class to calculate the ratio between both axes of the ellipse
 class CBlobGetAxisRatio: public COperadorBlob
 {
@@ -726,7 +706,7 @@ public:
 class CBlobGetXYInside: public COperadorBlob
 {
 public:
-	//! Constructor est�ndard
+	//! Constructor est�ndard
 	//! Standard constructor
 	CBlobGetXYInside()
 	{
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobProperties.h b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobProperties.h
index 51c1017292f4391f1767e8b9634a4fbbeda96107..97d028a14f87af36b3a04813dcb4ba5518f0f165 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobProperties.h
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobProperties.h
@@ -5,15 +5,12 @@
 #ifndef BLOB_PROPERTIES_H_INCLUDED
 #define BLOB_PROPERTIES_H_INCLUDED
 
-#include <opencv/cxcore.h>
-#include "BlobLibraryConfiguration.h"
-#include "BlobContour.h"
+#include <list>
 
+#include <opencv2/opencv.hpp>
 
-#ifdef BLOB_OBJECT_FACTORY
-	//! Object factory pattern implementation
-	#include "..\inspecta\DesignPatterns\ObjectFactory.h"
-#endif
+#include "BlobLibraryConfiguration.h"
+#include "BlobContour.h"
 
 
 //! Type of labelled images
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.cpp
index 93167cd232edbb6c1fc73670503077d9fe1347e3..7e84c531f5b62877f5b34fb6848e3102c73fd2b5 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.cpp
@@ -13,12 +13,6 @@ MODIFICACIONS (Modificaci�, Autor, Data):
 #include <algorithm>
 #include "BlobResult.h"
 
-//! Show errors functions: only works for windows releases
-#ifdef _SHOW_ERRORS
-	#include <afx.h>			//suport per a CStrings
-	#include <afxwin.h>			//suport per a AfxMessageBox
-#endif
-
 /**************************************************************************
 		Constructors / Destructors
 **************************************************************************/
@@ -92,7 +86,7 @@ CBlobResult::CBlobResult()
 - CREATION DATE: 25-05-2005.
 - MODIFICATION: Date. Author. Description.
 */
-CBlobResult::CBlobResult(IplImage *source, IplImage *mask, uchar backgroundColor )
+CBlobResult::CBlobResult(cv::Mat source, cv::Mat* mask, uchar backgroundColor )
 {
 	bool success;
 
@@ -310,58 +304,6 @@ void CBlobResult::AddBlob( CBlob *blob )
 }
 
 
-#ifdef MATRIXCV_ACTIU
-
-/**
-- FUNCI�: GetResult
-- FUNCIONALITAT: Calcula el resultat especificat sobre tots els blobs de la classe
-- PAR�METRES:
-	- evaluador: Qualsevol objecte derivat de COperadorBlob
-- RESULTAT:
-	- Retorna un array de double's amb el resultat per cada blob
-- RESTRICCIONS:
-- AUTOR: Ricard Borr�s
-- DATA DE CREACI�: 25-05-2005.
-- MODIFICACI�: Data. Autor. Descripci�.
-*/
-/**
-- FUNCTION: GetResult
-- FUNCTIONALITY: Computes the function evaluador on all the blobs of the class
-				 and returns a vector with the result
-- PARAMETERS:
-	- evaluador: function to apply to each blob (any object derived from the 
-				 COperadorBlob class )
-- RESULT:
-	- vector with all the results in the same order as the blobs
-- RESTRICTIONS:
-- AUTHOR: Ricard Borr�s
-- CREATION DATE: 25-05-2005.
-- MODIFICATION: Date. Author. Description.
-*/
-double_vector CBlobResult::GetResult( funcio_calculBlob *evaluador ) const
-{
-	if( GetNumBlobs() <= 0 )
-	{
-		return double_vector();
-	}
-
-	// definim el resultat
-	double_vector result = double_vector( GetNumBlobs() );
-	// i iteradors sobre els blobs i el resultat
-	double_vector::iterator itResult = result.GetIterator();
-	Blob_vector::const_iterator itBlobs = m_blobs.begin();
-
-	// avaluem la funci� en tots els blobs
-	while( itBlobs != m_blobs.end() )
-	{
-		*itResult = (*evaluador)(**itBlobs);
-		itBlobs++;
-		itResult++;
-	}
-	return result;
-}
-#endif
-
 /**
 - FUNCI�: GetSTLResult
 - FUNCIONALITAT: Calcula el resultat especificat sobre tots els blobs de la classe
@@ -857,8 +799,7 @@ void CBlobResult::ClearBlobs()
 - PARAMETERS:
 	- errorCode: reason of the error
 - RESULT:
-	- in _SHOW_ERRORS version, shows a message box with the error. In release is silent.
-	  In both cases throws an exception with the error.
+	- Throws an exception with the error.
 - RESTRICTIONS:
 - AUTHOR: Ricard Borr�s
 - CREATION DATE: 25-05-2005.
@@ -866,23 +807,6 @@ void CBlobResult::ClearBlobs()
 */
 void CBlobResult::RaiseError(const int errorCode) const
 {
-//! Do we need to show errors?
-#ifdef _SHOW_ERRORS
-	CString msg, format = "Error en CBlobResult: %s";
-
-	switch (errorCode)
-	{
-	case EXCEPTION_BLOB_OUT_OF_BOUNDS:
-		msg.Format(format, "Intentant accedir a un blob no existent");
-		break;
-	default:
-		msg.Format(format, "Codi d'error desconegut");
-		break;
-	}
-
-	AfxMessageBox(msg);
-
-#endif
 	throw errorCode;
 }
 
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.h b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.h
index 5d86142f2eb5e3dfb899cd0b4c218fc7444831fe..cf5c18209ea04c27953853d887f2fe9b03f340a8 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.h
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/BlobResult.h
@@ -21,22 +21,17 @@ MODIFICATIONS (Modification, Author, Date):
 
 #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 <opencv2/opencv.hpp>
 
 #include <vector>		// vectors de la STL
 #include <functional>
 #include "blob.h"
 #include "BlobOperators.h"
 #include "ComponentLabeling.h"
+
+//! Vector de doubles
+typedef std::vector<double> double_stl_vector;
+
 /**************************************************************************
 	Filtres / Filters
 **************************************************************************/
@@ -82,7 +77,7 @@ public:
 	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);
+	CBlobResult(cv::Mat source, cv::Mat* mask, uchar backgroundColor);
 	//! constructor de c�pia
 	//! Copy constructor
 	CBlobResult( const CBlobResult &source );
@@ -100,11 +95,6 @@ public:
 	//! 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;
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.cpp
index 5aff312507e4d33cd8d094384fe469d30bf1b8e1..6bfaa09af4966b9389490cb3a9915195ec79d830 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.cpp
@@ -4,83 +4,58 @@
 #include <thread>
 #include <mutex>
 #include <future>
-#include <opencv2/opencv.hpp>
 
 //! Conversion from freeman code to coordinate increments (counterclockwise)
-static const CvPoint freemanCodeIncrement[8] =
+static const cv::Point freemanCodeIncrement[8] =
     { {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1} };
 
 
-
-/**
-- FUNCI�: 
-- FUNCIONALITAT: 
-- PAR�METRES:
-	- 
-- RESULTAT:
-	- 
-- RESTRICCIONS:
-	- 
-- AUTOR: rborras
-- DATA DE CREACI�: 2008/04/29
-- MODIFICACI�: Data. Autor. Descripci�.
-*/
-inline unsigned char GET_ABOVE_IMAGEPIXEL( unsigned char *currentPixel, IplImage *image )
+inline unsigned char GET_IMAGE_PIXEL( cv::Mat image, cv::Point p )
 {
-	return *(currentPixel - image->widthStep);
+	return image.at<unsigned char>(p);
 }
-inline unsigned char GET_BELOW_IMAGEPIXEL( unsigned char *currentPixel, IplImage *image )
-{
-	return *(currentPixel + image->widthStep);
-}
-
 
-
-inline unsigned char GET_IMAGE_PIXEL( IplImage *image, CvPoint p )
-{
-	return *(image->imageData + p.x + p.y *image->widthStep);
-}
-
-inline bool GET_IMAGEMASK_PIXEL( IplImage *mask, CvPoint p )
+inline bool GET_IMAGEMASK_PIXEL( cv::Mat* mask, cv::Point p )
 {
-	if( mask != NULL )
-		return ((unsigned char)*(mask->imageData + p.x + p.y *mask->widthStep)) > 0;
+	if(mask)
+		return mask->at<unsigned char>(p) > 0;
 	else
 		return true;
 }
+
 inline bool GET_BELOW_VISITEDPIXEL( bool *currentPixel, int imageWidth )
 {
 	return *( currentPixel + imageWidth );
 }
 
 /**
-- FUNCI�: ASSIGN_LABEL
+- FUNCI�: ASSIGN_LABEL
 - FUNCIONALITAT: Assigns label value to label image
-- PAR�METRES:
+- PAR�METRES:
 	- 
 - RESULTAT:
 	- 
 - RESTRICCIONS:
 	- 
 - AUTOR: rborras
-- DATA DE CREACI�: 2008/04/29
-- MODIFICACI�: Data. Autor. Descripci�.
+- DATA DE CREACI�: 2008/04/29
+- MODIFICACI�: Data. Autor. Descripci�.
 */
-inline void ASSIGN_LABEL( CvPoint p, t_labelType *labels, int imageWidth, int newLabel )
+inline void ASSIGN_LABEL( cv::Point p, t_labelType *labels, int imageWidth, int newLabel )
 {
 	*(labels + p.y * imageWidth + p.x) = newLabel;
 }
 
 
-inline void ASSIGN_VISITED( CvPoint p, bool *visitedPoints, int imageWidth  )
+inline void ASSIGN_VISITED( cv::Point p, bool *visitedPoints, int imageWidth  )
 {
 	*(visitedPoints + p.y * imageWidth + p.x) = true;
 }
 
 /**
-- FUNCI�: ComponentLabeling
+- FUNCI�: ComponentLabeling
 - FUNCIONALITAT: Calcula els components binaris (blobs) d'una imatge amb connectivitat a 8
-- PAR�METRES:
+- PAR�METRES:
 	- inputImage: image to segment (pixel values different than blobColor are treated as background)
 	- maskImage: if not NULL, all the pixels equal to 0 in mask are skipped in input image
 	- backgroundColor: color of background (ignored pixels)
@@ -90,13 +65,13 @@ inline void ASSIGN_VISITED( CvPoint p, bool *visitedPoints, int imageWidth  )
 - RESTRICCIONS:
 	- 
 - AUTOR: rborras
-- DATA DE CREACI�: 2008/04/21
-- MODIFICACI�: Data. Autor. Descripci�.
+- DATA DE CREACI�: 2008/04/21
+- MODIFICACI�: Data. Autor. Descripci�.
 - NOTA: Algorithm based on "A linear-time component labeling algorithm using contour tracing technique", 
 		F.Chang et al
 */
-bool ComponentLabeling(	IplImage* inputImage,
-						IplImage* maskImage,
+bool ComponentLabeling(cv::Mat inputImage,
+						cv::Mat* maskImage,
 						unsigned char backgroundColor,
 						Blob_vector &blobs )
 {
@@ -105,30 +80,28 @@ bool ComponentLabeling(	IplImage* inputImage,
 	int imageWidth, imageHeight, currentLabel, contourLabel;
 	//! current blob pointer
 	CBlob *currentBlob;
-	CvSize imageSizes;
-	CvPoint currentPoint;
+	cv::Size imageSizes;
+	cv::Point currentPoint;
 
 	// verify input image
-	if( !CV_IS_IMAGE( inputImage ) )
+	if (!inputImage.empty())
 		return false;
 
 	// verify that input image and mask image has same size
-	if( maskImage )
+	if (maskImage)
 	{
-		if( !CV_IS_IMAGE(maskImage) || 
-			maskImage->width != inputImage->width || 
-			maskImage->height != inputImage->height )
-		return false;
+		if (inputImage.size() != maskImage->size())
+			return false;
 	}
 
-	imageSizes = cvSize(inputImage->width,inputImage->height);
+	imageSizes = inputImage.size();
 	
-	imageWidth = inputImage->width;
-	imageHeight = inputImage->height;
+	imageWidth = imageSizes.width;
+	imageHeight = imageSizes.height;
 
 	// create auxiliary buffers that are initialized to 0
-	t_labelType *labelledImage = (t_labelType*)calloc(inputImage->width * inputImage->height, sizeof(t_labelType));
-	bool *visitedPoints = (bool*)calloc(inputImage->width * inputImage->height, sizeof(bool));
+	t_labelType *labelledImage = (t_labelType*) calloc(imageWidth * imageHeight, sizeof(t_labelType));
+	bool *visitedPoints = (bool*) calloc(imageWidth * imageHeight, sizeof(bool));
 
 	// Execute the POI detection parallel.
 	// This basically just filters out the background (which is the majority of points).
@@ -142,9 +115,9 @@ bool ComponentLabeling(	IplImage* inputImage,
 	const int regionHeight = imageHeight / totalRegionsY;
 
 	// get the pixel data from an image at a certain position
-	auto getImageData = [](const IplImage * const & image, const int &row, const int &column)
+	auto getImageData = [](cv::Mat image, const int row, const int column)
 	{
-		return (unsigned char*)image->imageData + row * image->widthStep + column;
+		return image.data + row * image.step + column;
 	};
 
 	// to allow each thread to acces the main list directly (saves us some merging later)
@@ -161,7 +134,7 @@ bool ComponentLabeling(	IplImage* inputImage,
 			const int pointY = startingY + j;
 			// ignore background pixels or 0 pixels in mask
 			const unsigned char * pInputImage = getImageData(inputImage, pointY, pointX);
-			if ((*pInputImage == backgroundColor) || (maskImage && *getImageData(maskImage, pointY, pointX) == 0))
+			if ((*pInputImage == backgroundColor) || (maskImage && *getImageData(*maskImage, pointY, pointX) == 0))
 			{
 				continue;
 			}
@@ -204,12 +177,12 @@ bool ComponentLabeling(	IplImage* inputImage,
 
 	auto getImageDataVisited = [&](const int &row, const int &column)
 	{
-		return visitedPoints + row * inputImage->widthStep + column;
+		return visitedPoints + row * inputImage.step + column;
 	};
 
 	auto getImageDataLabelled = [&](const int &row, const int &column)
 	{
-		return labelledImage + row * inputImage->widthStep + column;
+		return labelledImage + row * inputImage.step + column;
 	};
 
 	for (const cv::Point2d & point : foregroundPoints)
@@ -226,7 +199,7 @@ bool ComponentLabeling(	IplImage* inputImage,
 			const unsigned char * pAboveInputImage = getImageData(inputImage, j - 1, i);
 
 			externalContour = ((*pAboveInputImage == backgroundColor) || 
-								(maskImage && *getImageData(maskImage, j - 1, i) == 0)) && 
+								(maskImage && *getImageData(*maskImage, j - 1, i) == 0)) && 
 								(*pLabels == 0);
 		}
 		else
@@ -247,7 +220,7 @@ bool ComponentLabeling(	IplImage* inputImage,
 			
 		if( externalContour )
 		{
-			currentPoint = cvPoint(i,j);
+			currentPoint = cv::Point(i,j);
 			// assign label to labelled image
 			*pLabels = currentLabel;
 				
@@ -268,7 +241,7 @@ bool ComponentLabeling(	IplImage* inputImage,
 		{
 			if( internalContour )
 			{
-				currentPoint = cvPoint(i,j);
+				currentPoint = cv::Point(i,j);
 
 				if( *pLabels == 0 )
 				{
@@ -313,206 +286,25 @@ bool ComponentLabeling(	IplImage* inputImage,
 	return true;
 }
 
-/* Original code */
-/*
-bool ComponentLabeling(IplImage* inputImage,
-	IplImage* maskImage,
-	unsigned char backgroundColor,
-	Blob_vector &blobs)
-{
-	int i, j;
-	// row major vector with visited points 
-	bool *visitedPoints, *pVisitedPoints, internalContour, externalContour;
-	unsigned char *pInputImage, *pMask, *pAboveInputImage, *pBelowInputImage,
-		*pAboveMask, *pBelowMask;
-	int imageWidth, imageHeight, currentLabel, contourLabel;
-	// row major vector with labelled image 
-	t_labelType *labelledImage, *pLabels;
-	//! current blob pointer
-	CBlob *currentBlob;
-	CvSize imageSizes;
-	CvPoint currentPoint;
-
-	// verify input image
-	if (!CV_IS_IMAGE(inputImage))
-		return false;
-
-	// verify that input image and mask image has same size
-	if (maskImage)
-	{
-		if (!CV_IS_IMAGE(maskImage) ||
-			maskImage->width != inputImage->width ||
-			maskImage->height != inputImage->height)
-			return false;
-	}
-	else
-	{
-		pMask = NULL;
-		pAboveMask = NULL;
-		pBelowMask = NULL;
-	}
-
-	imageSizes = cvSize(inputImage->width, inputImage->height);
-
-	imageWidth = inputImage->width;
-	imageHeight = inputImage->height;
-
-	// create auxiliary buffers
-	labelledImage = (t_labelType*)malloc(inputImage->width * inputImage->height * sizeof(t_labelType));
-	visitedPoints = (bool*)malloc(inputImage->width * inputImage->height * sizeof(bool));
-
-	// initialize it to 0
-	memset(labelledImage, 0, inputImage->width * inputImage->height * sizeof(t_labelType));
-	memset(visitedPoints, false, inputImage->width * inputImage->height * sizeof(bool));
-
-	// initialize pointers and label counter
-	pLabels = labelledImage;
-	pVisitedPoints = visitedPoints;
-	currentLabel = 1;
-
-	for (j = 0; j < imageHeight; j++)
-	{
-		// don't verify if we area on first or last row, it will verified on pointer access
-		pAboveInputImage = (unsigned char*)inputImage->imageData + (j - 1) * inputImage->widthStep;
-		pBelowInputImage = (unsigned char*)inputImage->imageData + (j + 1) * inputImage->widthStep;
-
-		pInputImage = (unsigned char*)inputImage->imageData + j * inputImage->widthStep;
-
-		if (maskImage)
-		{
-			pMask = (unsigned char*)maskImage->imageData + j * maskImage->widthStep;
-			// don't verify if we area on first or last row, it will verified on pointer access
-			pAboveMask = (unsigned char*)maskImage->imageData + (j - 1) * maskImage->widthStep;
-			pBelowMask = (unsigned char*)maskImage->imageData + (j + 1) * maskImage->widthStep;
-
-		}
-
-		for (i = 0; i < imageWidth; i++, pInputImage++, pMask++, pAboveInputImage++, pBelowInputImage++,
-			pAboveMask++, pBelowMask++)
-		{
-			// ignore background pixels or 0 pixels in mask
-			if ((*pInputImage == backgroundColor) || (maskImage && *pMask == 0))
-			{
-				pLabels++;
-				pVisitedPoints++;
-				continue;
-			}
-
-			// new external contour: current label == 0 and above pixel is background
-			if (j > 0)
-			{
-				externalContour = ((*pAboveInputImage == backgroundColor) ||
-					(maskImage && *pAboveMask == 0)) &&
-					(*pLabels == 0);
-			}
-			else
-				externalContour = (*pLabels == 0);
-
-			// new internal contour: below pixel is background and not visited
-			if (!externalContour && j < imageHeight - 1)
-			{
-				internalContour = *pBelowInputImage == backgroundColor &&
-					!GET_BELOW_VISITEDPIXEL(pVisitedPoints, imageWidth);
-			}
-			else
-			{
-				internalContour = false;
-			}
-
-
-			if (externalContour)
-			{
-				currentPoint = cvPoint(i, j);
-				// assign label to labelled image
-				*pLabels = currentLabel;
-
-				// create new blob
-				currentBlob = new CBlob(currentLabel, currentPoint, imageSizes);
-
-				// contour tracing with currentLabel
-				contourTracing(inputImage, maskImage, currentPoint,
-					labelledImage, visitedPoints,
-					currentLabel, false, backgroundColor, currentBlob->GetExternalContour());
-
-				// add new created blob
-				blobs.push_back(currentBlob);
-
-				currentLabel++;
-			}
-			else
-			{
-				if (internalContour)
-				{
-					currentPoint = cvPoint(i, j);
-
-					if (*pLabels == 0)
-					{
-						// take left neightbour value as current
-						if (i > 0)
-							contourLabel = *(pLabels - 1);
-					}
-					else
-					{
-						contourLabel = *pLabels;
-					}
-
-					if (contourLabel>0)
-					{
-						currentBlob = blobs[contourLabel - 1];
-						CBlobContour newContour(currentPoint, currentBlob->GetStorage());
-
-
-						// contour tracing with contourLabel
-						contourTracing(inputImage, maskImage, currentPoint, labelledImage, visitedPoints,
-							contourLabel, true, backgroundColor, &newContour);
-
-						currentBlob->AddInternalContour(newContour);
-					}
-				}
-				// neither internal nor external contour
-				else
-				{
-					// take left neightbour value as current if it is not labelled
-					if (i > 0 && *pLabels == 0)
-						*pLabels = *(pLabels - 1);
-				}
-
-			}
-
-			pLabels++;
-			pVisitedPoints++;
-
-		}
-	}
-
-
-	// free auxiliary buffers
-	free(labelledImage);
-	free(visitedPoints);
-
-	return true;
-}
-*/
-
 /**
-- FUNCI�: 
+- FUNCI�: 
 - FUNCIONALITAT: 
-- PAR�METRES:
+- PAR�METRES:
 	- 
 - RESULTAT:
 	- 
 - RESTRICCIONS:
 	- 
 - AUTOR: rborras
-- DATA DE CREACI�: 2008/04/29
-- MODIFICACI�: Data. Autor. Descripci�.
+- DATA DE CREACI�: 2008/04/29
+- MODIFICACI�: Data. Autor. Descripci�.
 */
-void contourTracing( IplImage *image, 
-					 IplImage *maskImage,
-					 CvPoint contourStart, t_labelType *labels, bool *visitedPoints, t_labelType label,
+void contourTracing( cv::Mat image, 
+					 cv::Mat* maskImage,
+					 cv::Point contourStart, t_labelType *labels, bool *visitedPoints, t_labelType label,
 					 bool internalContour, unsigned char backgroundColor, CBlobContour *currentBlobcontour )
 {
-	CvPoint t, tnext, tsecond;
+	cv::Point t, tnext, tsecond;
 	short initialMovement, movement;
 
 	if( internalContour )
@@ -528,7 +320,7 @@ void contourTracing( IplImage *image,
 					backgroundColor, movement );
 	
 	// assign current label to tnext
-	ASSIGN_LABEL( contourStart, labels, image->width, label );
+	ASSIGN_LABEL( contourStart, labels, image.size().width, label );
 	
 
 	// contour corresponds to isolated pixel? 
@@ -542,7 +334,7 @@ void contourTracing( IplImage *image,
 	currentBlobcontour->AddChainCode(movement);
 	
 	// assign label to next point 
-	ASSIGN_LABEL( tsecond, labels, image->width, label );
+	ASSIGN_LABEL( tsecond, labels, image.size().width, label );
 	
 	tnext.x = tsecond.x;
 	tnext.y = tsecond.y;
@@ -564,7 +356,7 @@ void contourTracing( IplImage *image,
 						backgroundColor, movement );
 		
 		// assign label to contour point
-		ASSIGN_LABEL( tnext, labels, image->width, label );
+		ASSIGN_LABEL( tnext, labels, image.size().width, label );
 
 		// add chain code to current contour
 		currentBlobcontour->AddChainCode(movement);
@@ -573,24 +365,24 @@ void contourTracing( IplImage *image,
 }
 
 /**
-- FUNCI�: tracer
+- FUNCI�: tracer
 - FUNCIONALITAT: Searches for next point of a contour
-- PAR�METRES:
+- PAR�METRES:
 	- 
 - RESULTAT:
 	- 
 - RESTRICCIONS:
 	- 
 - AUTOR: rborras
-- DATA DE CREACI�: 2008/04/30
-- MODIFICACI�: Data. Autor. Descripci�.
+- DATA DE CREACI�: 2008/04/30
+- MODIFICACI�: Data. Autor. Descripci�.
 */
-CvPoint tracer( IplImage *image, IplImage *maskImage, CvPoint P, bool *visitedPoints,
+cv::Point tracer( cv::Mat image, cv::Mat* maskImage, cv::Point P, bool *visitedPoints,
 				short initialMovement,
 				unsigned char backgroundColor, short &movement )
 {
 	int d;
-	CvPoint pNext;
+	cv::Point pNext;
 	
 	for (d = 0; d <= 7; d++ )
 	{
@@ -600,8 +392,8 @@ CvPoint tracer( IplImage *image, IplImage *maskImage, CvPoint P, bool *visitedPo
 		pNext.y = P.y + freemanCodeIncrement[movement].y;
 
 		// the point is inside image ?
-		if( pNext.x < 0 || pNext.x >= image->width || 
-			pNext.y < 0 || pNext.y >= image->height )
+		if( pNext.x < 0 || pNext.x >= image.size().width || 
+			pNext.y < 0 || pNext.y >= image.size().height )
 		{
 			// try other movement
 			continue;
@@ -615,7 +407,7 @@ CvPoint tracer( IplImage *image, IplImage *maskImage, CvPoint P, bool *visitedPo
 		else
 		{
 			// mark point as visited
-			ASSIGN_VISITED( pNext, visitedPoints, image->width );
+			ASSIGN_VISITED( pNext, visitedPoints, image.size().width );
 		}
 	}
 
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.h b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.h
index d6e714e6c82c78ec155994ac2acc73dfb8564002..5aa8ee58af70bd531dbb15cf7f3baee4660351a1 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.h
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/ComponentLabeling.h
@@ -6,23 +6,23 @@
 #include "blob.h"
 
 
-//! definici� de que es un vector de blobs
+//! definici� de que es un vector de blobs
 typedef std::vector<CBlob*>	Blob_vector;
 
 
 
-bool ComponentLabeling(	IplImage* inputImage,
-						IplImage* maskImage,
+bool ComponentLabeling(cv::Mat inputImage,
+						cv::Mat* maskImage,
 						unsigned char backgroundColor,
 						Blob_vector &blobs );
 
 
-void contourTracing( IplImage *image, IplImage *mask, CvPoint contourStart, t_labelType *labels, 
+void contourTracing( cv::Mat image, cv::Mat* mask, cv::Point 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,
+cv::Point tracer( cv::Mat image, cv::Mat* mask, cv::Point P, bool *visitedPoints,
 				short initialMovement,
 				unsigned char backgroundColor, short &movement );
 				
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.cpp
index 7f1a5cc6d745421968387079cb90c1d0d94e3d06..b53402f8cd8e8d122433df37ce868db04ed41749 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.cpp
@@ -15,7 +15,9 @@ MODIFICATIONS (Modification, Author, Date):
 
 
 #include "blob.h"
+
 #include <opencv2/opencv.hpp>
+#include <opencv2/imgproc/imgproc_c.h>
 
 
 CBlob::CBlob()
@@ -27,7 +29,7 @@ CBlob::CBlob()
 	m_storage = NULL;
 	m_id = -1;
 }
-CBlob::CBlob( t_labelType id, CvPoint startPoint, CvSize originalImageSize )
+CBlob::CBlob( t_labelType id, cv::Point startPoint, cv::Size originalImageSize )
 {
 	m_id = id;
 	m_area = m_perimeter = -1;
@@ -249,7 +251,7 @@ double CBlob::ExternPerimeter( IplImage *maskImage, bool xBorder /* = true */, b
 	t_PointList externContour, externalPoints;
 	CvSeqReader reader;
 	CvSeqWriter writer;
-	CvPoint actualPoint, previousPoint;
+	cv::Point actualPoint, previousPoint;
 	bool find = false;
 	int i,j;
 	int delta = 0;
@@ -418,7 +420,7 @@ double CBlob::Mean( IplImage *image )
 	// Create a mask with same size as blob bounding box
 	IplImage *mask;
 	CvScalar mean, std;
-	CvPoint offset;
+	cv::Point offset;
 
 	GetBoundingBox();
 	
@@ -496,7 +498,7 @@ CvRect CBlob::GetBoundingBox()
 
 	t_PointList externContour;
 	CvSeqReader reader;
-	CvPoint actualPoint;
+	cv::Point actualPoint;
 	
 	// get contour pixels
 	externContour = m_externalContour.GetContourPoints();
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.h b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.h
index e4c80f8310d7dcca6751fcab345a72e541e301b0..2d30a4d57bc6a09fa666c7ea940042d52e29d25f 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.h
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/cvblobs/blob.h
@@ -1,9 +1,9 @@
 /************************************************************************
   			Blob.h
   			
-FUNCIONALITAT: Definici� de la classe CBlob
+FUNCIONALITAT: Definici� de la classe CBlob
 AUTOR: Inspecta S.L.
-MODIFICACIONS (Modificaci�, Autor, Data):
+MODIFICACIONS (Modificaci�, Autor, Data):
 
 FUNCTIONALITY: Definition of the CBlob class and some helper classes to perform
 			   some calculations on it
@@ -18,15 +18,12 @@ MODIFICATIONS (Modification, Author, Date):
 #ifndef CBLOB_INSPECTA_INCLUDED
 #define CBLOB_INSPECTA_INCLUDED
 
-#include <opencv/cxcore.h>
-#include "BlobLibraryConfiguration.h"
-#include "BlobContour.h"
+#include <list>
 
+#include <opencv2/opencv.hpp>
 
-#ifdef BLOB_OBJECT_FACTORY
-	//! Object factory pattern implementation
-	#include "..\inspecta\DesignPatterns\ObjectFactory.h"
-#endif
+#include "BlobLibraryConfiguration.h"
+#include "BlobContour.h"
 
 
 //! Type of labelled images
@@ -40,14 +37,14 @@ class CBlob
 
 public:
 	CBlob();
-	CBlob( t_labelType id, CvPoint startPoint, CvSize originalImageSize );
+	CBlob( t_labelType id, cv::Point startPoint, cv::Size originalImageSize );
 	~CBlob();
 
 	//! Copy constructor
 	CBlob( const CBlob &src );
 	CBlob( const CBlob *src );
 
-	//! Operador d'assignaci�
+	//! Operador d'assignaci�
 	//! Assigment operator
 	CBlob& operator=(const CBlob &src );
 	
@@ -89,7 +86,7 @@ public:
 	//! Get standard deviation grey color
 	double StdDev( IplImage *image );
 
-	//! Indica si el blob est� buit ( no t� cap info associada )
+	//! Indica si el blob est� buit ( no t� cap info associada )
 	//! Shows if the blob has associated information
 	bool IsEmpty();
 
@@ -166,7 +163,7 @@ private:
 	//! Bounding ellipse
 	CvBox2D m_ellipse;
 	//! Sizes from image where blob is extracted
-	CvSize m_originalImageSize;
+	cv::Size m_originalImageSize;
 };
 
 #endif //CBLOB_INSPECTA_INCLUDED
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/detector/blob/cvBlob/BlobsDetector.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/detector/blob/cvBlob/BlobsDetector.cpp
index cccde5bcd983de2d68b6a1592544471ee1daf2ec..cfd62a6ce774a2260960d741c62d458e19b850ba 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/detector/blob/cvBlob/BlobsDetector.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/detector/blob/cvBlob/BlobsDetector.cpp
@@ -11,16 +11,14 @@ BlobsDetector::BlobsDetector(void) :
 
 void BlobsDetector::filterBlobsBySize(CBlobResult& blobs)
 {
-	//std::cout << "start blobs: " << blobs.GetNumBlobs() << std::endl;
 	// blobs smaller than the provided blob size	
 	blobs.Filter( blobs, B_INCLUDE, CBlobGetArea(), B_GREATER_OR_EQUAL, minBlobSize());
-	//std::cout << "min filtered blobs: " << blobs.GetNumBlobs() << " min: " << minBlobSize() << std::endl;
+
 	// blobs bigger than the provided blob size	
 	blobs.Filter( blobs, B_INCLUDE, CBlobGetArea(), B_LESS_OR_EQUAL, maxBlobSize());
-	//std::cout << "max filtered blobs: " << blobs.GetNumBlobs() << " max: " << maxBlobSize() << std::endl;
 }
 
-bool isLeft(CvPoint a, CvPoint b, CvPoint c) {
+bool isLeft(cv::Point a, cv::Point b, cv::Point c) {
     return ((b.x - a.x)*(c.y - a.y) - (b.y - a.y)*(c.x - a.x)) > 0;
 }
 
@@ -28,14 +26,8 @@ std::vector<BlobPose> BlobsDetector::findBlobs(const cv::Mat& processedImage, co
 {
 	std::vector<BlobPose> blobPoses;
 
-	IplImage iplBinImage(processedImage);
-	IplImage *img = 0;
-	if (_mask)
-		img = new IplImage(*_mask);
-
 	CBlob *currentBlob;
-	CBlobResult blobs(&iplBinImage, img, 0);
-	delete img;
+	CBlobResult blobs(processedImage, _mask, 0);
 
 	// filter the blobs by size criteria
 	filterBlobsBySize(blobs);	
@@ -55,29 +47,11 @@ std::vector<BlobPose> BlobsDetector::findBlobs(const cv::Mat& processedImage, co
 		// ignore blobs outside the tracking area
 		if (!_areaInfo->inTrackingArea(blobPose_px))
 			continue;
-        /*
-        CBlobContour * contour = currentBlob->GetExternalContour();
-        t_PointList externContour = contour->GetContourPoints();
-        CvMemStorage storage;
-        CvPoint actualPoint, previousPoint;
-        CvSeqReader reader;
-        cvStartReadSeq(externContour, &reader);
-
-        // which contour pixels touch border?
-        for (int j = 0; j < externContour->total; j++)
-        {
-            CV_READ_SEQ_ELEM(actualPoint, reader);
-            if (j == 0) previousPoint = actualPoint;
-            //std::cout << actualPoint.x << "/" << actualPoint.y << std::endl;
-            //std::cout << isLeft(CvPoint a, CvPoint b, actualPoint) << std::endl;
-           
-            previousPoint = actualPoint;
-        }*/
         
 		float blobPose_angle_deg = currentBlob->GetEllipse().angle;
 		float blobPose_angle_rad = currentBlob->GetEllipse().angle * CV_PI / float(180.0);
 		assert(blobPose_angle_deg >= 0.0f && blobPose_angle_deg <= 360.0f);
-		//std::cout << "angle: " << blobPose_angle_deg << std::endl;
+
 		float blobPose_width =  currentBlob->GetEllipse().size.width;
 		float blobPose_height = currentBlob->GetEllipse().size.height;
 
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/detector/contour/ContoursDetector.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/detector/contour/ContoursDetector.cpp
index 4eeabd6ecfc1a826af66c801466ae35670181059..59e7a93119c23e8709586820651ba2c68ffbcce6 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/detector/contour/ContoursDetector.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/detector/contour/ContoursDetector.cpp
@@ -28,7 +28,7 @@ void ContoursDetector::createMask(std::vector<cv::Point> points)
 //		}
 //	}
 //		
-//	CvPoint maskPoints[4];
+//	cv::Point maskPoints[4];
 //
 //	for(int z=0;z<4;z++)
 //	{
@@ -36,7 +36,7 @@ void ContoursDetector::createMask(std::vector<cv::Point> points)
 //	}
 //
 //	//Array im Array von Polygonen. Hier Gr��e eins, da nur eins erzeugt wird
-//	CvPoint* contours[1]={
+//	cv::Point* contours[1]={
 //		maskPoints,
 //	};
 //
diff --git a/Src/Model/TrackingAlgorithm/imageProcessor/preprocessor/ImagePreProcessor.cpp b/Src/Model/TrackingAlgorithm/imageProcessor/preprocessor/ImagePreProcessor.cpp
index bb9c66b3858639d722453da25272c057a2cee299..e0ae07b2bd63311b7e8af12d411a7cb399a279e8 100644
--- a/Src/Model/TrackingAlgorithm/imageProcessor/preprocessor/ImagePreProcessor.cpp
+++ b/Src/Model/TrackingAlgorithm/imageProcessor/preprocessor/ImagePreProcessor.cpp
@@ -58,12 +58,10 @@ void ImagePreProcessor::init()
 
 cv::Mat ImagePreProcessor::binarize(cv::Mat& image)
 {
-	//cv::cvtColor( image, grayImage, CV_BGR2GRAY );
-
 	cv::Mat binarizedImage;
 
 	if (image.channels() >= 3)
-		cv::cvtColor(image, binarizedImage, CV_BGR2GRAY);
+		cv::cvtColor(image, binarizedImage, cv::COLOR_BGR2GRAY);
 	else
 		image.copyTo(binarizedImage);
 
@@ -175,8 +173,7 @@ std::map<std::string, std::shared_ptr<cv::Mat>> ImagePreProcessor::preProcess(st
 	std::shared_ptr<cv::Mat> dilatedImage	= std::make_shared<cv::Mat>();
 	//cv::Mat test;
 
-	cv::cvtColor(*p_image, *greyMat, CV_BGR2GRAY);
-	//cv::cvtColor(*p_image, test, CV_BGR2GRAY);
+	cv::cvtColor(*p_image, *greyMat, cv::COLOR_BGR2GRAY);
 	
 	// 1. step: do the background subtraction
 	*m_foregroundImage = backgroundSubtraction(*greyMat);
diff --git a/Src/helper/CvHelper.cpp b/Src/helper/CvHelper.cpp
index fd903319794920be2d34ab75ae514c4fd1ffd811..5cf0a91f9c3a7ab1f832d491870689c0c7045187 100644
--- a/Src/helper/CvHelper.cpp
+++ b/Src/helper/CvHelper.cpp
@@ -2,19 +2,19 @@
 
 #include "StringHelper.h"
 
-CvPoint CvHelper::subtractTwoCvPoints(CvPoint a, CvPoint b)
+cv::Point CvHelper::subtractTwoCvPoints(cv::Point a, cv::Point b)
 {
-	return cvPoint(a.x - b.x, a.y - b.y);
+	return cv::Point(a.x - b.x, a.y - b.y);
 }
 
-CvPoint CvHelper::addTwoCvPoints(CvPoint a, CvPoint b)
+cv::Point CvHelper::addTwoCvPoints(cv::Point a, cv::Point b)
 {
-	return cvPoint(a.x + b.x, a.y + b.y);
+	return cv::Point(a.x + b.x, a.y + b.y);
 }
 
-CvPoint CvHelper::multCvPoint(double scalar, CvPoint p)
+cv::Point CvHelper::multCvPoint(double scalar, cv::Point p)
 {
-	return cvPoint(scalar * p.x, scalar * p.y);
+	return cv::Point(scalar * p.x, scalar * p.y);
 }
 
 QPointF CvHelper::norm(double x, double y)
diff --git a/Src/helper/CvHelper.h b/Src/helper/CvHelper.h
index c608a15d7eb466da17d510c9bdb3be6bf37e2b76..774b064b098a1868e5b6b41e0f718e08d0871ea7 100644
--- a/Src/helper/CvHelper.h
+++ b/Src/helper/CvHelper.h
@@ -19,15 +19,15 @@ namespace CvHelper
 	 * Subtract operation for two CvPoints.
 	 * @return: the difference of the CvPoints. 
 	 */
-	CvPoint subtractTwoCvPoints(CvPoint a, CvPoint b);
+	cv::Point subtractTwoCvPoints(cv::Point a, cv::Point b);
 
 	/**
 	 * Add operation for two CvPoints.
 	 * @return: the sum of the CvPoints. 
 	 */
-	CvPoint addTwoCvPoints(CvPoint a, CvPoint b);
+	cv::Point addTwoCvPoints(cv::Point a, cv::Point b);
 
-	CvPoint multCvPoint(double scalar, CvPoint p);
+	cv::Point multCvPoint(double scalar, cv::Point p);
 
 	/**
 	 * Normalizes a coordinate point.