You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
1.6 KiB

#include "BlobProperties.h"
/**
- FUNCIÓ: GetPerimeter
- FUNCIONALITAT: Get perimeter from chain code. Diagonals sum sqrt(2) and horizontal and vertical codes 1
- PARÀMETRES:
-
- RESULTAT:
-
- RESTRICCIONS:
-
- AUTOR: rborras
- 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
*/
#define SQRT2 1.414213562
/**
- FUNCIÓ: GetPerimeter
- FUNCIONALITAT: Get blob area, ie. external contour area minus internal contours area
- PARÀMETRES:
-
- RESULTAT:
-
- RESTRICCIONS:
-
- AUTOR: rborras
- DATA DE CREACIÓ: 2008/04/30
- MODIFICACIÓ: Data. Autor. Descripció.
*/
float CBlobProperties::GetArea()
{
float area;
t_contourList::iterator itContour;
area = m_externalContour.GetArea();
itContour = m_internalContours.begin();
while (itContour != m_internalContours.end() )
{
area += (*itContour).GetArea();
itContour++;
}
return area;
}
/**
- FUNCIÓ: GetPerimeter
- FUNCIONALITAT: Get blob perimeter, ie. sum of the lenght of all the contours
- PARÀMETRES:
-
- RESULTAT:
-
- RESTRICCIONS:
-
- AUTOR: rborras
- DATA DE CREACIÓ: 2008/04/30
- MODIFICACIÓ: Data. Autor. Descripció.
*/
float CBlobProperties::GetPerimeter()
{
float perimeter;
t_contourList::iterator itContour;
perimeter = m_externalContour.GetPerimeter();
itContour = m_internalContours.begin();
while (itContour != m_internalContours.end() )
{
perimeter += (*itContour).GetPerimeter();
itContour++;
}
return perimeter;
}