27 #include <mrpt/otherlibs/do_opencv_includes.h> 46 CFaceDetection::CFaceDetection() :
48 m_enter_checkIfFaceRegions(0,1),
49 m_enter_checkIfFacePlaneCov(0,1),
50 m_enter_checkIfDiagonalSurface(0,1),
51 m_leave_checkIfFaceRegions(0,1),
52 m_leave_checkIfFacePlaneCov(0,1),
53 m_leave_checkIfDiagonalSurface(0,1)
165 vector<size_t> deleteDetected;
168 for (
unsigned int i = 0; i < localDetected.size(); i++ )
170 CDetectable2DPtr rec = CDetectable2DPtr(localDetected[i]);
173 unsigned int r1 = rec->m_y;
174 unsigned int r2 = rec->m_y + rec->m_height;
175 unsigned int c1 = rec->m_x;
176 unsigned int c2 = rec->m_x + rec->m_width;
207 deleteDetected.push_back( i );
238 deleteDetected.push_back( i );
243 deleteDetected.push_back( i );
249 deleteDetected.push_back( i );
276 for (
unsigned int i = deleteDetected.size(); i > 0; i-- )
277 localDetected.erase( localDetected.begin() + deleteDetected[i-1] );
281 for (
unsigned int i = 0; i < localDetected.size(); i++ )
283 CDetectable3DPtr object3d =
284 CDetectable3DPtr(
new CDetectable3D((CDetectable2DPtr)localDetected[i]) );
285 detected.push_back( object3d );
296 detected = localDetected;
318 size_t N =
face->points3D_x.size();
322 for (
size_t i = 0; i < N; i++ )
342 obj->thread_checkIfFacePlaneCov( );
375 const unsigned int faceWidth =
face->intensityImage.getWidth();
376 const unsigned int faceHeight =
face->intensityImage.getHeight();
379 const bool confidence =
face->hasConfidenceImage;
382 vector<CArrayDouble<3> > pointsVector;
387 for (
unsigned int j = 0; j < faceHeight; j++ )
389 for (
unsigned int k = 0; k < faceWidth; k++ )
393 if ( region.
get_unsafe( j,k ) && (( (!confidence) || (( confidence ) &&
395 && ( *(
face->intensityImage.get_unsafe( k, j )) > 50 )))))
397 int position = faceWidth*j + k;
398 aux[0] =
face->points3D_x[position];
399 aux[1] =
face->points3D_y[position];
400 aux[2] =
face->points3D_z[position];
401 pointsVector.push_back( aux );
407 if ( pointsVector.empty() )
419 cov.eigenValues( eVals );
421 cov.eigenVectors( eVects, m_eVals );
438 cout << eVals[0] <<
" " << eVals[1] <<
" " << eVals[2] <<
" > " ;
439 cout << eVals[0]/eVals[2] << endl;
450 if ( eVals[0]/eVals[2] > 0.06 )
470 obj->thread_checkIfFaceRegions( );
505 const unsigned int faceWidth =
face->intensityImage.getWidth();
506 const unsigned int faceHeight =
face->intensityImage.getHeight();
509 unsigned int sectionVSize = faceHeight/3.0;
526 int numPoints[3][3] = { {0,0,0}, {0,0,0}, {0,0,0} };
528 vector<TPoint3D> regions2[9];
560 if (
end == 0 )
end = faceWidth-1;
561 if (
end < 3*(faceWidth/4) )
end = 3*(faceWidth/4);
563 if (
start > faceWidth/4 )
start = faceWidth/4;
568 unsigned int utilWidth = faceWidth -
start - ( faceWidth -
end );
569 unsigned int c1 = ceil( utilWidth/3.0 +
start );
570 unsigned int c2 = ceil( 2*(utilWidth/3.0) +
start );
580 size_t countHist = 0;
581 for (
size_t i = 0; i < 60; i++ )
587 size_t downLimit = faceHeight-1;
589 if ( countHist > 10 )
591 upLimit = floor(faceHeight*0.1);
592 downLimit = floor(faceHeight*0.9);
602 unsigned int cont = 0;
604 for (
unsigned int r = 0;
r < faceHeight;
r++ )
606 for (
unsigned int c = 0;
c < faceWidth;
c++, cont++ )
608 if ( (
r >= upLimit ) && (
r <= downLimit )
611 && ( *(
face->intensityImage.get_unsafe(
c,
r )) > 50) )
613 unsigned int row, col;
614 if (
r < sectionVSize + upLimit*0.3)
616 else if (
r < sectionVSize*2 - upLimit*0.15 )
630 meanPos[
row][col] = meanPos[
row][col] + point;
632 ++numPoints[
row][col];
634 if (
row == 0 && col == 0 )
635 regions2[0].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
636 else if (
row == 0 && col == 1 )
637 regions2[1].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
638 else if (
row == 0 && col == 2 )
639 regions2[2].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
640 else if (
row == 1 && col == 0 )
641 regions2[3].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
642 else if (
row == 1 && col == 1 )
643 regions2[4].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
644 else if (
row == 1 && col == 2 )
645 regions2[5].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
646 else if (
row == 2 && col == 0 )
647 regions2[6].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
648 else if (
row == 2 && col == 1 )
649 regions2[7].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
651 regions2[8].push_back(
TPoint3D(
face->points3D_x[cont],
face->points3D_y[cont],
face->points3D_z[cont] ) );
662 vector<double> oldPointsX1;
667 if ( regions2[0].
size() > 0 )
669 for (
size_t i = 0; i < regions2[0].size(); i++ )
670 oldPointsX1.push_back( regions2[0][i].x );
672 middle1 = floor((
double)oldPointsX1.size()/2);
673 nth_element(oldPointsX1.begin(),oldPointsX1.begin()+middle1,oldPointsX1.end());
676 vector<double> oldPointsX2;
678 if ( regions2[2].
size() > 0 )
680 for (
size_t i = 0; i < regions2[2].size(); i++ )
681 oldPointsX2.push_back( regions2[2][i].x );
683 middle2 = floor((
double)oldPointsX2.size()/2);
684 nth_element(oldPointsX2.begin(),oldPointsX2.begin()+middle2,oldPointsX2.end());
687 for (
size_t i = 0; i < 3; i++ )
688 for (
size_t j = 0; j < 3; j++ )
689 if ( !numPoints[i][j] )
690 meanPos[i][j] =
TPoint3D( 0, 0, 0 );
692 meanPos[i][j] = meanPos[i][j] / numPoints[i][j];
694 if ( regions2[0].
size() > 0 )
695 meanPos[0][0].
x = oldPointsX1.at(middle1);
697 if ( regions2[2].
size() > 0 )
698 meanPos[0][2].
x = oldPointsX2.at(middle2);
703 vector<double> dist(5);
711 f.open(
"dist.txt", ofstream::app);
712 f <<
sum(dist) << endl;
718 else if ((
res = 1 ) && (
sum(dist) > 0.04 ))
721 f.open(
"tam.txt",ofstream::app);
722 f << meanPos[0][1].
distanceTo( meanPos[2][1] ) << endl;
772 double yIdeal = y1 + ( ((
x-x1)*(y2-y1)) / (x2-x1) );
794 obj->thread_checkIfDiagonalSurface( );
831 const unsigned int faceWidth =
face->intensityImage.getWidth();
832 const unsigned int faceHeight =
face->intensityImage.getHeight();
836 unsigned int x1 = ceil(faceWidth*0.25);
837 unsigned int x2 = floor(faceWidth*0.75);
838 unsigned int y1 = ceil(faceHeight*0.15);
839 unsigned int y2 = floor(faceHeight*0.85);
842 unsigned int cont = ( y1 == 0 ? 0 : faceHeight*(y1-1));
845 valids.
setSize(faceHeight,faceWidth);
850 for (
unsigned int i = y1; i <= y2; i++ )
854 for (
unsigned int j = x1; j <= x2; j++, cont++ )
858 sumDepth +=
face->points3D_x[cont];
863 cont += faceWidth-x2-1;
866 double meanDepth = sumDepth / total;
879 double maxFaceDistance = 0.5 + 1000 / ( pow( faceWidth, 1.9 ) );
896 if ( maxFaceDistance < meanDepth )
919 f.open(
"relaciones2.txt", ofstream::app);
920 f << meanDepth << endl;
929 cont = ( y1 == 1 ? 0 : faceHeight*(y1-1));
931 for (
unsigned int i = y1; i <= y2; i++ )
935 for (
unsigned int j = x1; j <= x2; j++, cont++ )
949 cont += faceWidth-x2-1;
958 double sumDistances = 0;
964 for (
unsigned int i = y1; i <= y2; i++ )
968 for (
unsigned int j = x1; j <= x2; j++, cont++ )
975 if ( ( i+1 <= y2 ) && ( j+1 <= x2 ) )
980 offsetIndex = cont + faceWidth + 1;
985 bool validOffset =
true;
988 while ( validOffset )
995 offsetIndex = cont + faceWidth +
offset;
1002 validOffset =
false;
1010 cont += faceWidth-x2-1;
1019 f.open(
"distances.txt", ofstream::app);
1021 f << sumDistances << endl;
1024 f.open(
"distances2.txt", ofstream::app);
1031 double yMax = 3 + 6 /( pow( meanDepth, 2) ) ;
1032 double yMin = 1 + 3.8 / ( pow( meanDepth+1.2, 2 ) );
1040 if ((( sumDistances <= yMax ) && ( sumDistances >= yMin ))&&(
res ) )
1086 const unsigned int faceWidth =
face->intensityImage.getWidth();
1087 const unsigned int faceHeight =
face->intensityImage.getHeight();
1098 for (
unsigned int row = 0;
row < faceHeight;
row++ )
1100 for (
unsigned int col = 0; col < faceWidth; col++, cont++ )
1105 sumDepth +=
face->points3D_x[cont];
1112 double meanDepth = sumDepth / total;
1118 double maxFaceDistance = 0.5 + 1000 / ( pow( faceWidth, 1.9 ) );
1135 if ( maxFaceDistance < meanDepth )
1158 f.open(
"relaciones2.txt", ofstream::app);
1159 f << meanDepth << endl;
1174 double sumDistances = 0;
1176 size_t offsetIndex = 0;
1180 for (
unsigned int i = 0; i < faceHeight; i++ )
1182 for (
unsigned int j = 0; j < faceWidth; j++, cont++ )
1187 if ( ( i+1 < faceHeight ) && ( j+1 < faceWidth ) )
1192 offsetIndex = cont + faceWidth + 1;
1197 bool validOffset =
true;
1200 while ( validOffset )
1202 if ( ( i +
offset < faceHeight ) && ( j +
offset < faceWidth ) )
1207 offsetIndex = cont + faceWidth +
offset;
1214 validOffset =
false;
1230 f.open(
"distances.txt", ofstream::app);
1232 f << sumDistances << endl;
1242 double yMax = 3 + 11.8 /( pow( meanDepth, 0.9) ) ;
1243 double yMin = 1 + 3.8 / ( pow( meanDepth+7, 6 ) );
1251 if ((( sumDistances <= yMax ) && ( sumDistances >= yMin ))&&(
res ) )
1286 vector<float> xs, ys, zs;
1288 unsigned int N =
face.points3D_x.size();
1294 for (
unsigned int i = 0; i < N; i++ )
1296 xs[i] =
face.points3D_x[i];
1297 ys[i] =
face.points3D_y[i];
1298 zs[i] =
face.points3D_z[i];
1311 vector<float> xs, ys, zs;
1313 unsigned int N =
points.size();
1319 for (
unsigned int i = 0; i < N; i++ )
1348 gl_points->setPointSize(4.5);
1352 scene->insert( gl_points );
1359 gl_points->loadFromPointsMap(&pntsMap);
1406 vector<float> xs, ys, zs;
1408 const size_t size = pointsVector.size();
1414 for (
size_t i = 0; i <
size; i++ )
1416 xs[i] = pointsVector[i][0];
1417 ys[i] = pointsVector[i][1];
1418 zs[i] = pointsVector[i][2];
1435 gl_points->setPointSize(4.5);
1439 CSpherePtr sphere = CSphere::Create(0.005f);
1440 sphere->setLocation( center );
1441 sphere->setColor(
TColorf(0,1,0) );
1442 scene->insert( sphere );
1448 TPoint3D E1( eigenVect.get_unsafe(0,0), eigenVect.get_unsafe(0,1), eigenVect.get_unsafe(0,2) );
1449 TPoint3D E2( eigenVect.get_unsafe(1,0), eigenVect.get_unsafe(1,1), eigenVect.get_unsafe(1,2) );
1450 TPoint3D E3( eigenVect.get_unsafe(2,0), eigenVect.get_unsafe(2,1), eigenVect.get_unsafe(2,2) );
1454 TPoint3D p1( center + E1*eigenVal[0]*100 );
1455 TPoint3D p2( center + E2*eigenVal[1]*100 );
1456 TPoint3D p3( center + E3*eigenVal[2]*100 );
1458 CArrowPtr arrow1 = CArrow::Create( center.
x, center.
y, center.
z, p1.x, p1.y, p1.z );
1459 CArrowPtr arrow2 = CArrow::Create( center.
x, center.
y, center.
z, p2.
x, p2.
y, p2.
z );
1460 CArrowPtr arrow3 = CArrow::Create( center.
x, center.
y, center.
z, p3.
x, p3.
y, p3.
z );
1462 arrow1->setColor(
TColorf(0,1,0) );
1463 arrow2->setColor(
TColorf(1,0,0) );
1464 arrow3->setColor(
TColorf(0,0,1) );
1466 scene->insert( arrow1 );
1467 scene->insert( arrow2 );
1468 scene->insert( arrow3 );
1480 scene->insert( gl_points );
1487 gl_points->loadFromPointsMap(&pntsMap);
1514 gl_points->setPointSize(6);
1518 if ( meanPos != NULL )
1520 for (
size_t i = 0; i < 3; i++ )
1521 for (
size_t j = 0; j < 3; j++ )
1523 CSpherePtr sphere = CSphere::Create(0.005f);
1524 sphere->setLocation( meanPos[i][j] );
1525 sphere->setColor(
TColorf(0,1,0) );
1526 scene->insert( sphere );
1530 vector<TSegment3D> sgms;
1531 sgms.push_back(
TSegment3D(meanPos[0][0],meanPos[0][1]) );
1532 sgms.push_back(
TSegment3D(meanPos[0][1],meanPos[0][2]) );
1533 sgms.push_back(
TSegment3D(meanPos[1][0],meanPos[1][1]) );
1534 sgms.push_back(
TSegment3D(meanPos[1][1],meanPos[1][2]) );
1535 sgms.push_back(
TSegment3D(meanPos[2][0],meanPos[2][1]) );
1536 sgms.push_back(
TSegment3D(meanPos[2][1],meanPos[2][2]) );
1537 sgms.push_back(
TSegment3D(meanPos[0][0],meanPos[1][1]) );
1538 sgms.push_back(
TSegment3D(meanPos[1][1],meanPos[2][2]) );
1539 sgms.push_back(
TSegment3D(meanPos[2][0],meanPos[1][1]) );
1540 sgms.push_back(
TSegment3D(meanPos[1][1],meanPos[0][2]) );
1542 lines->setColor(0,0,1,1);
1543 lines->setLineWidth( 10 );
1545 scene->insert( lines );
1547 scene->insert( gl_points );
1553 vector<float> xs, ys, zs;
1555 for (
size_t i = 0; i < 9; i++ )
1556 for (
unsigned int j = 0; j < regions[i].size(); j++ )
1558 xs.push_back( regions[i][j].
x );
1559 ys.push_back( regions[i][j].
y );
1560 zs.push_back( regions[i][j].
z );
1566 float colors[9][3] = {{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{0.5f,0.25f,0},{0.5f,0,0.25f},{0,0.35f,0.5f}};
1567 for (
size_t i = 0; i < 9; i++ )
1569 float R = colors[i][0];
1570 float G = colors[i][1];
1571 float B = colors[i][2];
1573 for (
unsigned int j = 0; j < regions[i].size(); j++, cont++ )
1577 gl_points->loadFromPointsMap(&pntsMap);
1593 const unsigned int faceWidth =
face.intensityImage.getWidth();
1594 const unsigned int faceHeight =
face.intensityImage.getHeight();
1596 region.
setSize( faceWidth, faceHeight,
true);
1598 unsigned int x1 = ceil(faceWidth*0.4);
1599 unsigned int x2 = floor(faceWidth*0.6);
1600 unsigned int y1 = ceil(faceHeight*0.4);
1601 unsigned int y2 = floor(faceHeight*0.6);
1603 region.
setSize(faceHeight,faceWidth);
1605 toExpand.
setSize(faceHeight,faceWidth,
true);
1607 unsigned int cont = ( y1 <= 1 ? 0 : faceHeight*(y1-1));
1616 img.setFromMatrix(range2D);
1619 for (
unsigned int i = y1; i <= y2; i++ )
1623 for (
unsigned int j = x1; j <= x2; j++, cont++ )
1634 cont += faceWidth-x2;
1663 bool newExpanded =
true;
1665 while ( newExpanded )
1667 newExpanded =
false;
1669 for (
size_t row = 0;
row < faceHeight;
row++ )
1671 for (
size_t col = 0; col < faceWidth; col++ )
1679 unsigned char *
c =
img.get_unsafe(col,
row);
1684 unsigned char *
c =
img.get_unsafe(col,
row-1);
1685 int value2 = (int)*
c;
1686 if ( abs(
value - value2 ) < 2 )
1695 unsigned char *
c =
img.get_unsafe(col,
row+1);
1696 int value2 = (int)*
c;
1697 if ( abs(
value - value2 ) < 2 )
1706 unsigned char *
c =
img.get_unsafe(col-1,
row);
1707 int value2 = (int)*
c;
1708 if ( abs(
value - value2 ) < 2 )
1715 if (( col < faceHeight-1) && ( toExpand.
get_unsafe(
row,col+1) != 2 ))
1717 unsigned char *
c =
img.get_unsafe(col+1,
row);
1718 int value2 = (int)*
c;
1719 if ( abs(
value - value2 ) < 2 )
1732 for (
unsigned int row = 0;
row < faceHeight;
row++ )
1734 for (
unsigned int col = 0; col < faceWidth; col++ )
1738 img.setPixel( col,
row, 0 );
1763 for (
size_t row = r1;
row <= r2 ;
row++ )
1764 for (
size_t col = c1; col <= c2; col++ )
1766 unsigned char *
c =
face.get_unsafe( col,
row );
1767 size_t value = (size_t)*
c;
1785 f.open(
"statistics.txt", ofstream::app);
1789 double meanEigenVal, stdEigenVal;
1795 cout << endl <<
"Statistical data about eigen values calculated of regions detected as faces" << endl;
1796 cout <<
"Min eigenVal: " << minEigenVal << endl;
1797 cout <<
"Max eigenVal: " << maxEigenVal << endl;
1798 cout <<
"Mean eigenVal: " << meanEigenVal << endl;
1799 cout <<
"Standard Desv: " << stdEigenVal << endl;
1803 f << endl <<
"Statistical data about eigen values calculated of regions detected as faces" << endl;
1804 f <<
"Min eigenVal: " << minEigenVal << endl;
1805 f <<
"Max eigenVal: " << maxEigenVal << endl;
1806 f <<
"Mean eigenVal: " << meanEigenVal << endl;
1807 f <<
"Standard Desv: " << stdEigenVal << endl;
1813 double meanSumDist, stdSumDist;
1819 cout << endl <<
"Statistical data about sum of distances" << endl;
1820 cout <<
"Min sumDistances: " << minSumDist << endl;
1821 cout <<
"Max sumDistances: " << maxSumDist << endl;
1822 cout <<
"Mean sumDistances: " << meanSumDist << endl;
1823 cout <<
"Standard Desv: " << stdSumDist << endl;
1827 f << endl <<
"Statistical data about sum of distances" << endl;
1828 f <<
"Min sumDistances: " << minSumDist << endl;
1829 f <<
"Max sumDistances: " << maxSumDist << endl;
1830 f <<
"Mean sumDistances: " << meanSumDist << endl;
1831 f <<
"Standard Desv: " << stdSumDist << endl;
1837 double meanEstimationErr, stdEstimationErr;
1843 cout << endl <<
"Statistical data about estimation error adjusting a plane of regions detected as faces" << endl;
1844 cout <<
"Min estimation: " << minEstimationErr << endl;
1845 cout <<
"Max estimation: " << maxEstimationErr << endl;
1846 cout <<
"Mean estimation: " << meanEstimationErr << endl;
1847 cout <<
"Standard Desv: " << stdEstimationErr << endl;
1851 f << endl <<
"Statistical data about estimation error adjusting a plane of regions detected as faces" << endl;
1852 f <<
"Min estimation: " << minEstimationErr << endl;
1853 f <<
"Max estimation: " << maxEstimationErr << endl;
1854 f <<
"Mean estimation: " << meanEstimationErr << endl;
1855 f <<
"Standard Desv: " << stdEstimationErr << endl;
1859 cout << endl <<
"Data about number of faces" << endl;
1872 cout << endl <<
"Mean hist: " << meanHist << endl;
1873 cout <<
"Min hist: " << minHist << endl;
1874 cout <<
"Max hist: " << maxHist << endl;
1875 cout <<
"Stdv: " << stdHist << endl;
1880 f << endl <<
"Data about number of faces" << endl;
1901 const unsigned int numFalsePositives = falsePositives.size();
1902 const unsigned int numIgnored = ignore.size();
1903 unsigned int ignoredDetected = 0;
1905 falsePositivesDeleted = 0;
1907 for (
unsigned int i = 0; i < numDeleted; i++ )
1911 bool falsePositive =
false;
1914 while (!falsePositive && ( j < numFalsePositives ) )
1916 if ( region == falsePositives[j] ) falsePositive =
true;
1920 if ( falsePositive )
1921 falsePositivesDeleted++;
1927 while (!igno && ( j < numIgnored ) )
1929 if ( region == ignore[j] ) igno =
true;
1938 realFacesDeleted = numDeleted - falsePositivesDeleted - ignoredDetected;
double regionsTest_sumDistThreshold_bottom
const T & get_unsafe(size_t row, size_t col) const
Fast but unsafe method to read a value from the matrix.
mrpt::utils::CTimeLogger m_timeLog
void meanAndStd(VEC &outMeanVector, VEC &outStdVector, const bool unbiased_variance=true) const
Computes a row with the mean values of each column in the matrix and the associated vector with the s...
GLuint GLuint GLsizei count
void unlockAccess3DScene()
Unlocks the access to the internal 3D scene.
double planeTest_eigenVal_top
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
bool m_end_threads
Indicates to all threads that must finish their execution.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
void thread_checkIfDiagonalSurface()
void getZoneAsObs(CObservation3DRangeScan &obs, const unsigned int &r1, const unsigned int &r2, const unsigned int &c1, const unsigned int &c2)
Extract a ROI of the 3D observation as a new one.
mrpt::system::TThreadHandle m_thread_checkIfFacePlaneCov
Thread that execute checkIfFacePlaneCov filter.
Declares a matrix of booleans (non serializable).
std::vector< uint32_t > vector_uint
CCascadeClassifierDetection cascadeClassifier
bool saveMeasurementsToFile
bool m_checkIfFaceRegions_res
Save result of checkIfFaceRegions filter.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
A class for storing images as grayscale or RGB bitmaps.
void debug_returnResults(const vector_uint &falsePositives, const vector_uint &ignore, unsigned int &falsePositivesDeleted, unsigned int &realFacesDeleted)
void detectObjects(const mrpt::obs::CObservationPtr obs, vector_detectable_object &detected)
void BASE_IMPEXP pause(const std::string &msg=std::string("Press any key to continue...")) MRPT_NO_THROWS
Shows the message "Press any key to continue" (or other custom message) to the current standard outpu...
std::vector< CDetectableObjectPtr > vector_detectable_object
static void dummy_checkIfDiagonalSurface(CFaceDetection *obj)
struct mrpt::detectors::CFaceDetection::TTestsOptions m_testsOptions
A pair (x,y) of pixel coordinates (integer resolution).
void setCameraPointingToPoint(float x, float y, float z)
Changes the camera parameters programmatically.
double planeTest_eigenVal_bottom
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
std::vector< double > m_meanHist
size_t checkRelativePosition(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p, double &dist)
bool waitForSignal(unsigned int timeout_ms=0)
Blocks until the count of the semaphore to be non-zero.
mrpt::synch::CSemaphore m_leave_checkIfFacePlaneCov
Indicates to main thread that thread_checkIfFacePlaneCov has been completed analisis of the last face...
void experimental_viewFacePointsAndEigenVects(const std::vector< mrpt::math::CArrayDouble< 3 > > &pointsVector, const mrpt::math::CMatrixDouble &eigenVect, const mrpt::math::CVectorDouble &eigenVal)
double z
X,Y,Z coordinates.
struct mrpt::detectors::CFaceDetection::TMeasurement m_measure
mrpt::system::TThreadHandle m_thread_checkIfFaceRegions
Thread that execute checkIfFaceRegions filter.
GLsizei GLsizei GLuint * obj
TThreadHandle createThread(void(*func)(T), T param)
Creates a new thread from a function (or static method) with one generic parameter.
struct BASE_IMPEXP TSegment3D
mrpt::obs::CObservation3DRangeScan m_lastFaceDetected
Last face detected.
void enable(bool enabled=true)
This class allows loading and storing values and vectors of different types from a configuration text...
GLsizei const GLfloat * points
mrpt::math::CMatrix rangeImage
If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters) ...
bool useDiagonalDistanceFilter
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
static CSetOfLinesPtr Create()
double regionsTest_sumDistThreshold_top
mrpt::opengl::COpenGLScenePtr & get3DSceneAndLock()
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introductio...
This base provides a set of functions for maths stuff.
mrpt::synch::CSemaphore m_leave_checkIfDiagonalSurface
Indicates to main thread that thread_checkIfDiagonalSurface has been completed analisis of the last f...
int numPossibleFacesDetected
vector_uint deletedRegions
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
bool checkIfDiagonalSurface2(mrpt::obs::CObservation3DRangeScan *face)
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
void setAllPoints(const std::vector< float > &X, const std::vector< float > &Y, const std::vector< float > &Z)
Set all the points at once from vectors with X,Y and Z coordinates.
bool checkIfFacePlaneCov(mrpt::obs::CObservation3DRangeScan *face)
std::string getStatsAsText(const size_t column_width=80) const
Dump all stats to a multi-line text string.
This class creates a window as a graphical user interface (GUI) for displaying images to the user...
bool useSizeDistanceRelationFilter
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements.
struct mrpt::detectors::CFaceDetection::TOptions m_options
void release(unsigned int increaseCount=1)
Increments the count of the semaphore by a given amount.
This namespace contains representation of robot actions and observations.
bool checkIfFaceRegions(mrpt::obs::CObservation3DRangeScan *face)
3D Plane, represented by its equation
void thread_checkIfFaceRegions()
void experimental_segmentFace(const mrpt::obs::CObservation3DRangeScan &face, mrpt::math::CMatrixTemplate< bool > ®ion)
double BASE_IMPEXP getRegressionPlane(const std::vector< TPoint3D > &points, TPlane &plane)
Using eigenvalues, gets the best fitting plane for a set of 3D points.
bool checkIfDiagonalSurface(mrpt::obs::CObservation3DRangeScan *face)
void thread_checkIfFacePlaneCov()
Specific class for face detection.
A map of 2D/3D points with individual colours (RGB).
void set_unsafe(size_t row, size_t col, const T &v)
Fast but unsafe method to write a value in the matrix.
bool hasPoints3D
true means the field points3D contains valid data.
void BASE_IMPEXP joinThread(TThreadHandle &threadHandle)
Waits until the given thread ends.
virtual void init(const mrpt::utils::CConfigFileBase &cfg)
Initialize the object with parameters loaded from the given config source.
void showImage(const mrpt::utils::CImage &img)
Show a given color or grayscale image on the window.
static CGridPlaneXYPtr Create()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void setWindowTitle(const std::string &str) MRPT_OVERRIDE
Changes the window title.
GLdouble GLdouble GLdouble r
mrpt::math::CVectorDouble lessEigenVals
bool checkIfFacePlane(mrpt::obs::CObservation3DRangeScan *face)
void experimental_viewFacePointsScanned(const std::vector< float > &xs, const std::vector< float > &ys, const std::vector< float > &zs)
virtual void init(const mrpt::utils::CConfigFileBase &cfg)
Initialize cascade classifier detection.
mrpt::synch::CSemaphore m_leave_checkIfFaceRegions
Indicates to main thread that thread_checkIfFaceRegions has been completed analisis of the last face ...
virtual void detectObjects_Impl(const mrpt::obs::CObservation *obs, vector_detectable_object &detected)
Declares a class that represents any robot's observation.
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
GLenum GLenum GLvoid * row
void experimental_showMeasurements()
mrpt::math::CVectorDouble errorEstimations
static void dummy_checkIfFacePlaneCov(CFaceDetection *obj)
void experimental_calcHist(const mrpt::utils::CImage &face, const size_t &c1, const size_t &r1, const size_t &c2, const size_t &r2, mrpt::math::CMatrixTemplate< unsigned int > &hist)
void setCameraZoom(float zoom)
Changes the camera parameters programmatically.
The namespace for 3D scene representation and rendering.
size_t getColCount() const
Number of columns in the matrix.
A RGB color - floats in the range [0,1].
static void dummy_checkIfFaceRegions(CFaceDetection *obj)
double leave(const char *func_name)
End of a named section.
size_t getRowCount() const
Number of rows in the matrix.
void setSize(size_t row, size_t col, bool zeroNewElements=false)
Changes the size of matrix, maintaining the previous contents.
mrpt::math::CVectorDouble sumDistances
Classes for creating GUI windows for 2D and 3D visualization.
mrpt::synch::CSemaphore m_enter_checkIfDiagonalSurface
Indicates to thread_checkIfDiagonalSurface that exist a new face to analyze.
mrpt::synch::CSemaphore m_enter_checkIfFaceRegions
Indicates to thread_checkIfFaceRegions that exist a new face to analyze.
GLsizei const GLfloat * value
void enter(const char *func_name)
Start of a named section.
mrpt::system::TThreadHandle m_thread_checkIfDiagonalSurface
Thread that execute checkIfDiagonalSurface filter.
bool m_checkIfDiagonalSurface_res
Save result of checkIfDiagonalSurface filter.
void resize(unsigned int width, unsigned int height) MRPT_OVERRIDE
Resizes the window, stretching the image to fit into the display area.
mrpt::synch::CSemaphore m_enter_checkIfFacePlaneCov
Indicates to thread_checkIfFacePlaneCov that exist a new face to analyze.
bool m_checkIfFacePlaneCov_res
Save result of checkIfFacePlaneCov filter.
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
void setCameraAzimuthDeg(float deg)
Changes the camera parameters programmatically.
GLenum GLuint GLint GLenum face
void setPointColor(size_t index, float R, float G, float B)
Changes just the color of a given point from the map.
void experimental_viewRegions(const std::vector< mrpt::math::TPoint3D > regions[9], const mrpt::math::TPoint3D meanPos[3][3])
static CPointCloudColouredPtr Create()
void setCameraElevationDeg(float deg)
Changes the camera parameters programmatically.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.