50 #include <visp3/core/vpMatrix.h>
51 #include <visp3/core/vpMath.h>
52 #include <visp3/core/vpColVector.h>
53 #include <visp3/core/vpPoint.h>
54 #include <visp3/vision/vpPose.h>
55 #include <visp3/core/vpDisplay.h>
56 #ifdef VISP_HAVE_MODULE_GUI
57 # include <visp3/gui/vpDisplayOpenCV.h>
58 # include <visp3/gui/vpDisplayX.h>
59 # include <visp3/gui/vpDisplayGDI.h>
61 #include <visp3/core/vpPixelMeterConversion.h>
62 #include <visp3/core/vpCameraParameters.h>
63 #include <visp3/core/vpColor.h>
64 #include <visp3/core/vpIoTools.h>
65 #include <visp3/core/vpException.h>
66 #ifdef VISP_HAVE_MODULE_IO
67 # include <visp3/io/vpImageIo.h>
69 #include <visp3/mbt/vpMbTracker.h>
70 #include <visp3/core/vpMatrixException.h>
71 #include <visp3/core/vpIoTools.h>
73 #ifdef VISP_HAVE_COIN3D
75 #include <Inventor/nodes/SoSeparator.h>
76 #include <Inventor/VRMLnodes/SoVRMLIndexedFaceSet.h>
77 #include <Inventor/VRMLnodes/SoVRMLIndexedLineSet.h>
78 #include <Inventor/VRMLnodes/SoVRMLCoordinate.h>
79 #include <Inventor/actions/SoWriteAction.h>
80 #include <Inventor/actions/SoSearchAction.h>
81 #include <Inventor/misc/SoChildList.h>
82 #include <Inventor/actions/SoGetMatrixAction.h>
83 #include <Inventor/actions/SoGetPrimitiveCountAction.h>
84 #include <Inventor/actions/SoToVRML2Action.h>
85 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
86 #include <Inventor/VRMLnodes/SoVRMLTransform.h>
87 #include <Inventor/VRMLnodes/SoVRMLShape.h>
92 #ifndef DOXYGEN_SHOULD_SKIP_THIS
99 SegmentInfo() : extremities(), name(), useLod(false), minLineLengthThresh(0.) {}
101 std::vector<vpPoint> extremities;
104 double minLineLengthThresh;
111 struct PolygonFaceInfo {
112 PolygonFaceInfo(
const double dist,
const vpPolygon &poly,
const std::vector<vpPoint> &corners)
113 : distanceToCamera(dist), polygon(poly), faceCorners(corners) {}
115 bool operator<(
const PolygonFaceInfo &pfi)
const {
116 return distanceToCamera < pfi.distanceToCamera;
119 double distanceToCamera;
121 std::vector<vpPoint> faceCorners;
124 #endif // DOXYGEN_SHOULD_SKIP_THIS
132 : cam(), cMo(), oJo(6,6), isoJoIdentity(true), modelFileName(), modelInitialised(false),
133 poseSavingFilename(), computeCovariance(false), covarianceMatrix(), computeProjError(false),
134 projectionError(90.0), displayFeatures(false), m_w(), m_error(), m_optimizationMethod(
vpMbTracker::GAUSS_NEWTON_OPT),
135 faces(), angleAppears(
vpMath::rad(89) ), angleDisappears(
vpMath::rad(89) ), distNearClip(0.001),
136 distFarClip(100), clippingFlag(
vpPolygon3D::NO_CLIPPING), useOgre(false), ogreShowConfigDialog(false), useScanLine(false),
137 nbPoints(0), nbLines(0), nbPolygonLines(0), nbPolygonPoints(0), nbCylinders(0), nbCircles(0),
138 useLodGeneral(false), applyLodSettingInConfig(false), minLineLengthThresholdGeneral(50.0),
139 minPolygonAreaThresholdGeneral(2500.0), mapOfParameterNames()
157 #ifdef VISP_HAVE_MODULE_GUI
188 std::string ext =
".init";
189 std::string str_pose =
"";
190 size_t pos = (
unsigned int)initFile.rfind(ext);
193 std::fstream finitpos ;
195 char s[FILENAME_MAX];
197 if( pos == initFile.size()-ext.size() && pos != 0)
198 str_pose = initFile.substr(0,pos) +
".0.pos";
200 str_pose = initFile +
".0.pos";
202 finitpos.open(str_pose.c_str() ,std::ios::in) ;
203 sprintf(s,
"%s", str_pose.c_str());
208 if(finitpos.fail() ){
209 std::cout <<
"cannot read " << s << std::endl <<
"cMo set to identity" << std::endl;
213 for (
unsigned int i = 0; i < 6; i += 1){
214 finitpos >> init_pos[i];
220 std::cout <<
"last_cMo : "<<std::endl << last_cMo <<std::endl;
227 std::cout <<
"No modification : left click " << std::endl;
228 std::cout <<
"Modify initial pose : right click " << std::endl ;
231 "left click to validate, right click to modify initial pose",
261 if( pos == initFile.size()-ext.size() && pos != 0)
262 sprintf(s,
"%s", initFile.c_str());
264 sprintf(s,
"%s.init", initFile.c_str());
266 std::cout <<
"Load 3D points from: " << s << std::endl ;
267 finit.open(s,std::ios::in) ;
269 std::cout <<
"cannot read " << s << std::endl;
273 #ifdef VISP_HAVE_MODULE_IO
278 if( pos == initFile.size()-ext.size() && pos != 0)
279 dispF = initFile.substr(0,pos) +
".ppm";
281 dispF = initFile +
".ppm";
284 std::cout <<
"Load image to help initialization: " << dispF << std::endl;
285 #if defined VISP_HAVE_X11
287 #elif defined VISP_HAVE_GDI
289 #elif defined VISP_HAVE_OPENCV
295 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
297 "Where to initialize...") ;
310 #else //#ifdef VISP_HAVE_MODULE_IO
312 #endif //#ifdef VISP_HAVE_MODULE_IO
316 while (!finit.fail() && (c ==
'#')) {
317 finit.ignore(256,
'\n');
324 finit.ignore(256,
'\n');
325 std::cout <<
"Number of 3D points " << n << std::endl ;
328 "Exceed the max number of points.");
332 for (
unsigned int i=0 ; i < n ; i++){
335 while (!finit.fail() && (c ==
'#')) {
336 finit.ignore(256,
'\n');
344 finit.ignore(256,
'\n');
346 std::cout <<
"Point " << i+1 <<
" with 3D coordinates: " << X <<
" " << Y <<
" " << Z << std::endl;
353 bool isWellInit =
false;
357 std::vector<vpImagePoint> mem_ip;
358 for(
unsigned int i=0 ; i< n ; i++)
360 std::ostringstream text;
361 text <<
"Click on point " << i+1;
364 for (
unsigned int k=0; k<mem_ip.size(); k++) {
369 std::cout <<
"Click on point " << i+1 <<
" ";
372 mem_ip.push_back(ip);
378 std::cout <<
"with 2D coordinates: " << ip << std::endl;
401 "left click to validate, right click to re initialize object",
438 std::cout <<
"cMo : "<<std::endl <<
cMo <<std::endl;
453 const std::string &displayFile)
460 std::vector<vpPoint> P;
461 for (
unsigned int i=0 ; i < points3D_list.size() ; i++)
462 P.push_back(
vpPoint(points3D_list[i].get_oX(), points3D_list[i].get_oY(), points3D_list[i].get_oZ()) );
464 #ifdef VISP_HAVE_MODULE_IO
469 std::cout <<
"Load image to help initialization: " << displayFile << std::endl;
470 #if defined VISP_HAVE_X11
472 #elif defined VISP_HAVE_GDI
474 #elif defined VISP_HAVE_OPENCV
479 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
481 "Where to initialize...") ;
493 #else //#ifdef VISP_HAVE_MODULE_IO
495 #endif //#ifdef VISP_HAVE_MODULE_IO
498 bool isWellInit =
false;
501 for(
unsigned int i=0 ; i< points3D_list.size() ; i++)
503 std::cout <<
"Click on point " << i+1 << std::endl ;
512 std::cout <<
"Click on point " << ip << std::endl;
535 "left click to validate, right click to re initialize object",
564 #endif //#ifdef VISP_HAVE_MODULE_GUI
585 char s[FILENAME_MAX];
588 std::string ext =
".init";
589 size_t pos = initFile.rfind(ext);
591 if( pos == initFile.size()-ext.size() && pos != 0)
592 sprintf(s,
"%s", initFile.c_str());
594 sprintf(s,
"%s.init", initFile.c_str());
596 std::cout <<
"filename " << s << std::endl ;
597 finit.open(s,std::ios::in) ;
599 std::cout <<
"cannot read " << s << std::endl;
606 std::cout <<
"number of points " << size << std::endl ;
610 "Exceed the max number of points.");
616 for(
unsigned int i=0 ; i< size ; i++)
629 vpERROR_TRACE(
"vpMbTracker::initFromPoints(), Number of 2D points different to the number of 3D points." );
631 for(
unsigned int i=0 ; i< size ; i++)
669 const std::vector<vpPoint> &points3D_list )
671 if(points2D_list.size() != points3D_list.size())
672 vpERROR_TRACE(
"vpMbTracker::initFromPoints(), Number of 2D points different to the number of 3D points." );
674 size_t size = points3D_list.size();
675 std::vector<vpPoint> P;
678 for(
size_t i=0 ; i< size ; i++)
680 P.push_back(
vpPoint(points3D_list[i].get_oX(), points3D_list[i].get_oY(), points3D_list[i].get_oZ()) );
723 char s[FILENAME_MAX];
727 std::string ext =
".pos";
728 size_t pos = initFile.rfind(ext);
730 if( pos == initFile.size()-ext.size() && pos != 0)
731 sprintf(s,
"%s", initFile.c_str());
733 sprintf(s,
"%s.pos", initFile.c_str());
735 finit.open(s,std::ios::in) ;
737 std::cout <<
"cannot read " << s << std::endl;
741 for (
unsigned int i = 0; i < 6; i += 1){
742 finit >> init_pos[i];
781 std::fstream finitpos ;
782 char s[FILENAME_MAX];
784 sprintf(s,
"%s", filename.c_str());
785 finitpos.open(s, std::ios::out) ;
788 finitpos << init_pos;
794 const bool useLod,
const double minPolygonAreaThreshold,
const double minLineLengthThreshold)
796 std::vector<vpPoint> corners_without_duplicates;
797 corners_without_duplicates.push_back(corners[0]);
798 for (
unsigned int i=0; i < corners.size()-1; i++) {
799 if (std::fabs(corners[i].get_oX() - corners[i+1].get_oX()) > std::fabs(corners[i].get_oX())*std::numeric_limits<double>::epsilon()
800 || std::fabs(corners[i].get_oY() - corners[i+1].get_oY()) > std::fabs(corners[i].get_oY())*std::numeric_limits<double>::epsilon()
801 || std::fabs(corners[i].get_oZ() - corners[i+1].get_oZ()) > std::fabs(corners[i].get_oZ())*std::numeric_limits<double>::epsilon()) {
802 corners_without_duplicates.push_back(corners[i+1]);
807 polygon.
setNbPoint((
unsigned int)corners_without_duplicates.size());
825 for(
unsigned int j = 0; j < corners_without_duplicates.size(); j++) {
826 polygon.
addPoint(j, corners_without_duplicates[j]);
842 const int idFace,
const std::string &polygonName,
const bool useLod,
const double minPolygonAreaThreshold)
876 y[0] = plane.
getA() / norm_Y;
877 y[1] = plane.
getB() / norm_Y;
878 y[2] = plane.
getC() / norm_Y;
881 for (
unsigned int i=0; i< 3; i++) {
897 for(
unsigned int i=0; i<4; i++) {
900 w_p = wMc * cMc_90 * c_p;
923 const bool useLod,
const double minLineLengthThreshold)
957 void vpMbTracker::addPolygon(
const std::vector<std::vector<vpPoint> > &listFaces,
const int idFace,
const std::string &polygonName,
958 const bool useLod,
const double minLineLengthThreshold)
961 for(
unsigned int i = 0 ; i < listFaces.size() ; i++)
964 polygon.
setNbPoint((
unsigned int)listFaces[i].size());
965 for(
unsigned int j = 0 ; j < listFaces[i].size() ; j++)
966 polygon.
addPoint(j, listFaces[i][j]);
1018 loadModel( std::string(modelFile), verbose );
1049 std::string::const_iterator it;
1052 it = modelFile.end();
1053 if((*(it-1) ==
'o' && *(it-2) ==
'a' && *(it-3) ==
'c' && *(it-4) ==
'.') ||
1054 (*(it-1) ==
'O' && *(it-2) ==
'A' && *(it-3) ==
'C' && *(it-4) ==
'.') ){
1055 std::vector<std::string> vectorOfModelFilename;
1063 loadCAOModel(modelFile, vectorOfModelFilename, startIdFace, verbose,
true);
1065 else if((*(it-1) ==
'l' && *(it-2) ==
'r' && *(it-3) ==
'w' && *(it-4) ==
'.') ||
1066 (*(it-1) ==
'L' && *(it-2) ==
'R' && *(it-3) ==
'W' && *(it-4) ==
'.') ){
1115 #ifdef VISP_HAVE_COIN3D
1119 SbBool ok = in.openFile(modelFile.c_str());
1120 SoVRMLGroup *sceneGraphVRML2;
1127 if(!in.isFileVRML2())
1129 SoSeparator *sceneGraph = SoDB::readAll(&in);
1130 if (sceneGraph == NULL) { }
1133 SoToVRML2Action tovrml2;
1134 tovrml2.apply(sceneGraph);
1136 sceneGraphVRML2 =tovrml2.getVRML2SceneGraph();
1137 sceneGraphVRML2->ref();
1138 sceneGraph->unref();
1142 sceneGraphVRML2 = SoDB::readAllVRML(&in);
1143 if (sceneGraphVRML2 == NULL) { }
1144 sceneGraphVRML2->ref();
1153 sceneGraphVRML2->unref();
1155 vpERROR_TRACE(
"coin not detected with ViSP, cannot load model : %s", modelFile.c_str());
1164 while (!fileId.fail() && (c ==
'#')) {
1165 fileId.ignore(256,
'\n');
1174 std::map<std::string, std::string> mapOfParams;
1177 while (!endLine.empty() && !exit) {
1180 for (std::map<std::string, std::string>::const_iterator it =
1183 endLine =
trim(endLine);
1185 std::string param(it->first +
"=");
1188 if (endLine.compare(0, param.size(), param) == 0) {
1190 endLine = endLine.substr(param.size());
1192 bool parseQuote =
false;
1193 if (it->second ==
"string") {
1195 if (endLine.size() > 2 && endLine[0] ==
'"') {
1197 endLine = endLine.substr(1);
1198 size_t pos = endLine.find_first_of(
'"');
1200 if (pos != std::string::npos) {
1201 mapOfParams[it->first] = endLine.substr(0, pos);
1202 endLine = endLine.substr(pos + 1);
1212 size_t pos1 = endLine.find_first_of(
' ');
1213 size_t pos2 = endLine.find_first_of(
'\t');
1214 size_t pos = pos1 < pos2 ? pos1 : pos2;
1216 mapOfParams[it->first] = endLine.substr(0, pos);
1217 endLine = endLine.substr(pos + 1);
1277 std::vector<std::string>& vectorOfModelFilename,
int& startIdFace,
1278 const bool verbose,
const bool parent) {
1279 std::ifstream fileId;
1280 fileId.exceptions(std::ifstream::failbit | std::ifstream::eofbit);
1281 fileId.open(modelFile.c_str(), std::ifstream::in);
1282 if (fileId.fail()) {
1283 std::cout <<
"cannot read CAO model file: " << modelFile << std::endl;
1288 std::cout <<
"Model file : " << modelFile << std::endl;
1290 vectorOfModelFilename.push_back(modelFile);
1303 fileId >> caoVersion;
1304 fileId.ignore(256,
'\n');
1307 <<
"in vpMbTracker::loadCAOModel() -> Bad parameter header file : use V0, V1, ...";
1309 "in vpMbTracker::loadCAOModel() -> Bad parameter header file : use V0, V1, ...");
1317 std::string prefix =
"load";
1321 bool header =
false;
1322 while(c ==
'l' || c ==
'L') {
1325 getline(fileId, line);
1326 if(!line.compare(0, prefix.size(), prefix)) {
1329 std::string headerPathRead = line.substr(6);
1330 size_t firstIndex = headerPathRead.find_first_of(
"\")");
1331 headerPathRead = headerPathRead.substr(0, firstIndex);
1333 std::string headerPath = headerPathRead;
1345 bool cyclic =
false;
1346 for (std::vector<std::string>::const_iterator it = vectorOfModelFilename.begin();
1347 it != vectorOfModelFilename.end() && !cyclic; ++it) {
1348 if (headerPath == *it) {
1355 loadCAOModel(headerPath, vectorOfModelFilename, startIdFace, verbose,
false);
1360 std::cout <<
"WARNING Cyclic dependency detected with file "
1361 << headerPath <<
" declared in " << modelFile << std::endl;
1374 unsigned int caoNbrPoint;
1375 fileId >> caoNbrPoint;
1376 fileId.ignore(256,
'\n');
1379 if(verbose || vectorOfModelFilename.size() == 1) {
1380 std::cout <<
"> " << caoNbrPoint <<
" points" << std::endl;
1383 if (caoNbrPoint > 100000) {
1385 "Exceed the max number of points in the CAO model.");
1388 if (caoNbrPoint == 0 && !header) {
1390 "in vpMbTracker::loadCAOModel() -> no points are defined");
1401 for (
unsigned int k = 0; k < caoNbrPoint; k++) {
1408 if (caoVersion == 2) {
1413 fileId.ignore(256,
'\n');
1424 std::map<std::pair<unsigned int, unsigned int>, SegmentInfo > segmentTemporaryMap;
1425 unsigned int caoNbrLine;
1426 fileId >> caoNbrLine;
1427 fileId.ignore(256,
'\n');
1430 unsigned int *caoLinePoints = NULL;
1431 if(verbose || vectorOfModelFilename.size() == 1) {
1432 std::cout <<
"> " << caoNbrLine <<
" lines" << std::endl;
1435 if (caoNbrLine > 100000) {
1438 "Exceed the max number of lines in the CAO model.");
1442 caoLinePoints =
new unsigned int[2 * caoNbrLine];
1444 unsigned int index1, index2;
1446 int idFace = startIdFace;
1448 for (
unsigned int k = 0; k < caoNbrLine; k++) {
1457 fileId.getline(buffer, 256);
1458 std::string endLine(buffer);
1459 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1461 std::string segmentName =
"";
1464 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1465 segmentName = mapOfParams[
"name"];
1467 if(mapOfParams.find(
"minLineLengthThreshold") != mapOfParams.end()) {
1468 minLineLengthThresh = std::atof(mapOfParams[
"minLineLengthThreshold"].c_str());
1470 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1474 SegmentInfo segmentInfo;
1475 segmentInfo.name = segmentName;
1476 segmentInfo.useLod = useLod;
1477 segmentInfo.minLineLengthThresh = minLineLengthThresh;
1479 caoLinePoints[2 * k] = index1;
1480 caoLinePoints[2 * k + 1] = index2;
1482 if (index1 < caoNbrPoint && index2 < caoNbrPoint) {
1483 std::vector<vpPoint> extremities;
1484 extremities.push_back(caoPoints[index1]);
1485 extremities.push_back(caoPoints[index2]);
1486 segmentInfo.extremities = extremities;
1488 std::pair<unsigned int, unsigned int> key(index1, index2);
1490 segmentTemporaryMap[key] = segmentInfo;
1492 vpTRACE(
" line %d has wrong coordinates.", k);
1502 std::vector<std::pair<unsigned int, unsigned int> > faceSegmentKeyVector;
1503 unsigned int caoNbrPolygonLine;
1504 fileId >> caoNbrPolygonLine;
1505 fileId.ignore(256,
'\n');
1508 if(verbose || vectorOfModelFilename.size() == 1) {
1509 std::cout <<
"> " << caoNbrPolygonLine <<
" polygon lines" << std::endl;
1512 if (caoNbrPolygonLine > 100000) {
1514 delete[] caoLinePoints;
1516 "Exceed the max number of polygon lines.");
1520 for (
unsigned int k = 0; k < caoNbrPolygonLine; k++) {
1523 unsigned int nbLinePol;
1524 fileId >> nbLinePol;
1525 std::vector<vpPoint> corners;
1526 if (nbLinePol > 100000) {
1530 for (
unsigned int n = 0; n < nbLinePol; n++) {
1533 if(index >= caoNbrLine) {
1536 corners.push_back(caoPoints[caoLinePoints[2 * index]]);
1537 corners.push_back(caoPoints[caoLinePoints[2 * index + 1]]);
1539 std::pair<unsigned int, unsigned int> key(caoLinePoints[2 * index], caoLinePoints[2 * index + 1]);
1540 faceSegmentKeyVector.push_back(key);
1547 fileId.getline(buffer, 256);
1548 std::string endLine(buffer);
1549 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1551 std::string polygonName =
"";
1554 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1555 polygonName = mapOfParams[
"name"];
1557 if(mapOfParams.find(
"minPolygonAreaThreshold") != mapOfParams.end()) {
1558 minPolygonAreaThreshold = std::atof(mapOfParams[
"minPolygonAreaThreshold"].c_str());
1560 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1569 for(std::map<std::pair<unsigned int, unsigned int>, SegmentInfo >::const_iterator it =
1570 segmentTemporaryMap.begin(); it != segmentTemporaryMap.end(); ++it) {
1571 if(std::find(faceSegmentKeyVector.begin(), faceSegmentKeyVector.end(), it->first) == faceSegmentKeyVector.end()) {
1573 it->second.minLineLengthThresh);
1583 unsigned int caoNbrPolygonPoint;
1584 fileId >> caoNbrPolygonPoint;
1585 fileId.ignore(256,
'\n');
1588 if(verbose || vectorOfModelFilename.size() == 1) {
1589 std::cout <<
"> " << caoNbrPolygonPoint <<
" polygon points"
1593 if (caoNbrPolygonPoint > 100000) {
1595 "Exceed the max number of polygon point.");
1598 for (
unsigned int k = 0; k < caoNbrPolygonPoint; k++) {
1601 unsigned int nbPointPol;
1602 fileId >> nbPointPol;
1603 if (nbPointPol > 100000) {
1605 "Exceed the max number of points.");
1607 std::vector<vpPoint> corners;
1608 for (
unsigned int n = 0; n < nbPointPol; n++) {
1610 if (index > caoNbrPoint - 1) {
1612 "Exceed the max number of points.");
1614 corners.push_back(caoPoints[index]);
1621 fileId.getline(buffer, 256);
1622 std::string endLine(buffer);
1623 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1625 std::string polygonName =
"";
1628 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1629 polygonName = mapOfParams[
"name"];
1631 if(mapOfParams.find(
"minPolygonAreaThreshold") != mapOfParams.end()) {
1632 minPolygonAreaThreshold = std::atof(mapOfParams[
"minPolygonAreaThreshold"].c_str());
1634 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1644 unsigned int caoNbCylinder;
1650 delete[] caoLinePoints;
1655 fileId >> caoNbCylinder;
1656 fileId.ignore(256,
'\n');
1659 if(verbose || vectorOfModelFilename.size() == 1) {
1660 std::cout <<
"> " << caoNbCylinder <<
" cylinders" << std::endl;
1663 if (caoNbCylinder > 100000) {
1665 "Exceed the max number of cylinders.");
1668 for (
unsigned int k = 0; k < caoNbCylinder; ++k) {
1672 unsigned int indexP1, indexP2;
1680 fileId.getline(buffer, 256);
1681 std::string endLine(buffer);
1682 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1684 std::string polygonName =
"";
1687 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1688 polygonName = mapOfParams[
"name"];
1690 if(mapOfParams.find(
"minLineLengthThreshold") != mapOfParams.end()) {
1691 minLineLengthThreshold = std::atof(mapOfParams[
"minLineLengthThreshold"].c_str());
1693 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1697 int idRevolutionAxis = idFace;
1698 addPolygon(caoPoints[indexP1], caoPoints[indexP2], idFace++, polygonName, useLod, minLineLengthThreshold);
1700 std::vector<std::vector<vpPoint> > listFaces;
1702 addPolygon(listFaces, idFace, polygonName, useLod, minLineLengthThreshold);
1705 initCylinder(caoPoints[indexP1], caoPoints[indexP2], radius, idRevolutionAxis, polygonName);
1709 std::cerr <<
"Cannot get the number of cylinders. Defaulting to zero."
1716 unsigned int caoNbCircle;
1722 delete[] caoLinePoints;
1727 fileId >> caoNbCircle;
1728 fileId.ignore(256,
'\n');
1731 if(verbose || vectorOfModelFilename.size() == 1) {
1732 std::cout <<
"> " << caoNbCircle <<
" circles" << std::endl;
1735 if (caoNbCircle > 100000) {
1737 "Exceed the max number of cicles.");
1740 for (
unsigned int k = 0; k < caoNbCircle; ++k) {
1744 unsigned int indexP1, indexP2, indexP3;
1753 fileId.getline(buffer, 256);
1754 std::string endLine(buffer);
1755 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1757 std::string polygonName =
"";
1760 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1761 polygonName = mapOfParams[
"name"];
1763 if(mapOfParams.find(
"minPolygonAreaThreshold") != mapOfParams.end()) {
1764 minPolygonAreaThreshold = std::atof(mapOfParams[
"minPolygonAreaThreshold"].c_str());
1766 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1770 addPolygon(caoPoints[indexP1], caoPoints[indexP2],
1771 caoPoints[indexP3], radius, idFace, polygonName, useLod, minPolygonAreaThreshold);
1773 initCircle(caoPoints[indexP1], caoPoints[indexP2],
1774 caoPoints[indexP3], radius, idFace++, polygonName);
1778 std::cerr <<
"Cannot get the number of circles. Defaulting to zero."
1783 startIdFace = idFace;
1786 delete[] caoLinePoints;
1788 if(vectorOfModelFilename.size() > 1 && parent) {
1790 std::cout <<
"Global information for " <<
vpIoTools::getName(modelFile) <<
" :" << std::endl;
1791 std::cout <<
"Total nb of points : " <<
nbPoints << std::endl;
1792 std::cout <<
"Total nb of lines : " <<
nbLines << std::endl;
1793 std::cout <<
"Total nb of polygon lines : " <<
nbPolygonLines << std::endl;
1794 std::cout <<
"Total nb of polygon points : " <<
nbPolygonPoints << std::endl;
1795 std::cout <<
"Total nb of cylinders : " <<
nbCylinders << std::endl;
1796 std::cout <<
"Total nb of circles : " <<
nbCircles << std::endl;
1798 std::cout <<
"> " <<
nbPoints <<
" points" << std::endl;
1799 std::cout <<
"> " <<
nbLines <<
" lines" << std::endl;
1800 std::cout <<
"> " <<
nbPolygonLines <<
" polygon lines" << std::endl;
1801 std::cout <<
"> " <<
nbPolygonPoints <<
" polygon points" << std::endl;
1802 std::cout <<
"> " <<
nbCylinders <<
" cylinders" << std::endl;
1803 std::cout <<
"> " <<
nbCircles <<
" circles" << std::endl;
1807 std::cerr <<
"Cannot read line!" << std::endl;
1812 #ifdef VISP_HAVE_COIN3D
1824 SoVRMLTransform *sceneGraphVRML2Trasnform =
dynamic_cast<SoVRMLTransform *
>(sceneGraphVRML2);
1825 if(sceneGraphVRML2Trasnform){
1826 float rx, ry, rz, rw;
1827 sceneGraphVRML2Trasnform->rotation.getValue().getValue(rx,ry,rz,rw);
1832 tx = sceneGraphVRML2Trasnform->translation.getValue()[0];
1833 ty = sceneGraphVRML2Trasnform->translation.getValue()[1];
1834 tz = sceneGraphVRML2Trasnform->translation.getValue()[2];
1839 sx = sceneGraphVRML2Trasnform->scale.getValue()[0];
1840 sy = sceneGraphVRML2Trasnform->scale.getValue()[1];
1841 sz = sceneGraphVRML2Trasnform->scale.getValue()[2];
1844 for(
unsigned int i = 0 ; i < 3 ; i++)
1846 for(
unsigned int i = 0 ; i < 3 ; i++)
1848 for(
unsigned int i = 0 ; i < 3 ; i++)
1852 transform = transform * transformCur;
1855 int nbShapes = sceneGraphVRML2->getNumChildren();
1861 for (
int i = 0; i < nbShapes; i++)
1864 child = sceneGraphVRML2->getChild(i);
1866 if (child->getTypeId() == SoVRMLGroup::getClassTypeId()){
1867 extractGroup((SoVRMLGroup*)child, transform_recursive, idFace);
1870 if (child->getTypeId() == SoVRMLTransform::getClassTypeId()){
1871 extractGroup((SoVRMLTransform*)child, transform_recursive, idFace);
1874 if (child->getTypeId() == SoVRMLShape::getClassTypeId()){
1875 SoChildList * child2list = child->getChildren();
1876 std::string name = child->getName().getString();
1878 for (
int j = 0; j < child2list->getLength(); j++)
1880 if (((SoNode*)child2list->get(j))->getTypeId() == SoVRMLIndexedFaceSet::getClassTypeId())
1882 SoVRMLIndexedFaceSet * face_set;
1883 face_set = (SoVRMLIndexedFaceSet*)child2list->get(j);
1884 if(!strncmp(face_set->getName().getString(),
"cyl",3)){
1890 if (((SoNode*)child2list->get(j))->getTypeId() == SoVRMLIndexedLineSet::getClassTypeId())
1892 SoVRMLIndexedLineSet * line_set;
1893 line_set = (SoVRMLIndexedLineSet*)child2list->get(j);
1913 std::vector<vpPoint> corners;
1918 int indexListSize = face_set->coordIndex.getNum();
1922 SoVRMLCoordinate *coord;
1924 for (
int i = 0; i < indexListSize; i++)
1926 if (face_set->coordIndex[i] == -1)
1928 if(corners.size() > 1)
1937 coord = (SoVRMLCoordinate *)(face_set->coord.getValue());
1938 int index = face_set->coordIndex[i];
1939 pointTransformed[0]=coord->point[index].getValue()[0];
1940 pointTransformed[1]=coord->point[index].getValue()[1];
1941 pointTransformed[2]=coord->point[index].getValue()[2];
1942 pointTransformed[3] = 1.0;
1944 pointTransformed = transform * pointTransformed;
1947 corners.push_back(pt);
1969 std::vector<vpPoint> corners_c1, corners_c2;
1970 SoVRMLCoordinate* coords = (SoVRMLCoordinate *)face_set->coord.getValue();
1972 unsigned int indexListSize = (
unsigned int)coords->point.getNum();
1974 if(indexListSize % 2 == 1){
1975 std::cout <<
"Not an even number of points when extracting a cylinder." << std::endl;
1978 corners_c1.resize(indexListSize / 2);
1979 corners_c2.resize(indexListSize / 2);
1986 for(
int i=0; i<coords->point.getNum(); ++i){
1987 pointTransformed[0]=coords->point[i].getValue()[0];
1988 pointTransformed[1]=coords->point[i].getValue()[1];
1989 pointTransformed[2]=coords->point[i].getValue()[2];
1990 pointTransformed[3] = 1.0;
1992 pointTransformed = transform * pointTransformed;
1996 if(i < (
int)corners_c1.size()){
1997 corners_c1[(
unsigned int)i] = pt;
1999 corners_c2[(
unsigned int)i-corners_c1.size()] = pt;
2007 dist[0] = p1.
get_oX() - corners_c1[0].get_oX();
2008 dist[1] = p1.
get_oY() - corners_c1[0].get_oY();
2009 dist[2] = p1.
get_oZ() - corners_c1[0].get_oZ();
2010 double radius_c1 = sqrt(dist.
sumSquare());
2011 dist[0] = p2.
get_oX() - corners_c2[0].get_oX();
2012 dist[1] = p2.
get_oY() - corners_c2[0].get_oY();
2013 dist[2] = p2.
get_oZ() - corners_c2[0].get_oZ();
2014 double radius_c2 = sqrt(dist.sumSquare());
2016 if(std::fabs(radius_c1 - radius_c2) > (std::numeric_limits<double>::epsilon() *
vpMath::maximum(radius_c1, radius_c2))){
2017 std::cout <<
"Radius from the two circles of the cylinders are different." << std::endl;
2024 int idRevolutionAxis = idFace;
2027 std::vector<std::vector<vpPoint> > listFaces;
2032 initCylinder(p1, p2, radius_c1, idRevolutionAxis, polygonName);
2046 std::vector<vpPoint> corners;
2049 int indexListSize = line_set->coordIndex.getNum();
2051 SbVec3f point(0,0,0);
2053 SoVRMLCoordinate *coord;
2055 for (
int i = 0; i < indexListSize; i++)
2057 if (line_set->coordIndex[i] == -1)
2059 if(corners.size() > 1)
2068 coord = (SoVRMLCoordinate *)(line_set->coord.getValue());
2069 int index = line_set->coordIndex[i];
2070 point[0]=coord->point[index].getValue()[0];
2071 point[1]=coord->point[index].getValue()[1];
2072 point[2]=coord->point[index].getValue()[2];
2075 corners.push_back(pt);
2080 #endif // VISP_HAVE_COIN3D
2095 std::cout <<
"Cannot extract center of gravity of empty set." << std::endl;
2103 for(
unsigned int i=0; i<pts.size(); ++i){
2105 oY += pts[i].get_oY();
2106 oZ += pts[i].get_oZ();
2123 std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > >
2127 std::vector<vpPolygon> polygonsTmp;
2128 std::vector<std::vector<vpPoint> > roisPtTmp;
2131 std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > > pairOfPolygonFaces;
2136 if ( (useVisibility &&
faces.
getPolygon()[i]->isvisible) || !useVisibility ) {
2137 std::vector<vpImagePoint> roiPts;
2145 if (roiPts.size() <= 2) {
2149 polygonsTmp.push_back(
vpPolygon(roiPts));
2151 std::vector<vpPoint> polyPts;
2159 roisPtTmp.push_back(polyPts);
2166 std::vector<PolygonFaceInfo> listOfPolygonFaces;
2167 for(
unsigned int i = 0; i < polygonsTmp.size(); i++) {
2168 double x_centroid = 0.0, y_centroid = 0.0, z_centroid = 0.0;
2169 for(
unsigned int j = 0; j < roisPtTmp[i].size(); j++) {
2170 x_centroid += roisPtTmp[i][j].get_X();
2171 y_centroid += roisPtTmp[i][j].get_Y();
2172 z_centroid += roisPtTmp[i][j].get_Z();
2175 x_centroid /= roisPtTmp[i].size();
2176 y_centroid /= roisPtTmp[i].size();
2177 z_centroid /= roisPtTmp[i].size();
2179 double squared_dist = x_centroid*x_centroid + y_centroid*y_centroid + z_centroid*z_centroid;
2180 listOfPolygonFaces.push_back(PolygonFaceInfo(squared_dist, polygonsTmp[i], roisPtTmp[i]));
2184 std::sort(listOfPolygonFaces.begin(), listOfPolygonFaces.end());
2186 polygonsTmp.resize(listOfPolygonFaces.size());
2187 roisPtTmp.resize(listOfPolygonFaces.size());
2190 for(std::vector<PolygonFaceInfo>::const_iterator it = listOfPolygonFaces.begin(); it != listOfPolygonFaces.end();
2192 polygonsTmp[cpt] = it->polygon;
2193 roisPtTmp[cpt] = it->faceCorners;
2196 pairOfPolygonFaces.first = polygonsTmp;
2197 pairOfPolygonFaces.second = roisPtTmp;
2199 pairOfPolygonFaces.first = polygonsTmp;
2200 pairOfPolygonFaces.second = roisPtTmp;
2203 return pairOfPolygonFaces;
2218 #ifndef VISP_HAVE_OGRE
2220 std::cout <<
"WARNING: ViSP doesn't have Ogre3D, basic visibility test will be used. setOgreVisibilityTest() set to false." << std::endl;
2234 vpTRACE(
"Far clipping value cannot be inferior than near clipping value. Far clipping won't be considered.");
2235 else if ( dist < 0 )
2236 vpTRACE(
"Far clipping value cannot be inferior than 0. Far clipping won't be considered.");
2240 for (
unsigned int i = 0; i <
faces.
size(); i ++){
2243 #ifdef VISP_HAVE_OGRE
2261 for (
unsigned int i = 0; i <
faces.
size(); i++)
2263 if(name.empty() ||
faces[i]->name == name) {
2264 faces[i]->setLod(useLod);
2280 for (
unsigned int i = 0; i <
faces.
size(); i++)
2282 if(name.empty() ||
faces[i]->name == name) {
2283 faces[i]->setMinLineLengthThresh(minLineLengthThresh);
2299 for (
unsigned int i = 0; i <
faces.
size(); i++)
2301 if(name.empty() ||
faces[i]->name == name) {
2302 faces[i]->setMinPolygonAreaThresh(minPolygonAreaThresh);
2316 vpTRACE(
"Near clipping value cannot be superior than far clipping value. Near clipping won't be considered.");
2317 else if ( dist < 0 )
2318 vpTRACE(
"Near clipping value cannot be inferior than 0. Near clipping won't be considered.");
2322 for (
unsigned int i = 0; i <
faces.
size(); i ++){
2325 #ifdef VISP_HAVE_OGRE
2342 for (
unsigned int i = 0; i <
faces.
size(); i ++)
2365 "Incorrect matrices size in computeJTR.");
2369 const unsigned int N = interaction.
getRows();
2371 for (
unsigned int i = 0; i < 6; i += 1){
2373 for (
unsigned int j = 0; j < N; j += 1){
2374 ssum += interaction[j][i] * error[j];
2395 for(
unsigned int i = 0 ; i < 6 ; i++)
2419 for(
unsigned int i = 0 ; i < 6 ; i++){
2421 if(std::fabs(v[i]) > std::numeric_limits<double>::epsilon()){
2456 if(axisOrtho.
euclideanNorm() < std::numeric_limits<double>::epsilon())
2461 if(axisOrtho.
euclideanNorm() < std::numeric_limits<double>::epsilon())
2466 if(axisOrtho.
euclideanNorm() < std::numeric_limits<double>::epsilon())
2496 std::vector<vpPoint> pointsFace;
2497 pointsFace.push_back(
vpPoint(fc1[0], fc1[1], fc1[2]) );
2498 pointsFace.push_back(
vpPoint(sc1[0], sc1[1], sc1[2]) );
2499 pointsFace.push_back(
vpPoint(sc2[0], sc2[1], sc2[2]) );
2500 pointsFace.push_back(
vpPoint(fc2[0], fc2[1], fc2[2]) );
2501 listFaces.push_back(pointsFace);
2504 pointsFace.push_back(
vpPoint(fc2[0], fc2[1], fc2[2]) );
2505 pointsFace.push_back(
vpPoint(sc2[0], sc2[1], sc2[2]) );
2506 pointsFace.push_back(
vpPoint(sc3[0], sc3[1], sc3[2]) );
2507 pointsFace.push_back(
vpPoint(fc3[0], fc3[1], fc3[2]) );
2508 listFaces.push_back(pointsFace);
2511 pointsFace.push_back(
vpPoint(fc3[0], fc3[1], fc3[2]) );
2512 pointsFace.push_back(
vpPoint(sc3[0], sc3[1], sc3[2]) );
2513 pointsFace.push_back(
vpPoint(sc4[0], sc4[1], sc4[2]) );
2514 pointsFace.push_back(
vpPoint(fc4[0], fc4[1], fc4[2]) );
2515 listFaces.push_back(pointsFace);
2518 pointsFace.push_back(
vpPoint(fc4[0], fc4[1], fc4[2]) );
2519 pointsFace.push_back(
vpPoint(sc4[0], sc4[1], sc4[2]) );
2520 pointsFace.push_back(
vpPoint(sc1[0], sc1[1], sc1[2]) );
2521 pointsFace.push_back(
vpPoint(fc1[0], fc1[1], fc1[2]) );
2522 listFaces.push_back(pointsFace);
virtual vpColVector getEstimatedDoF() const
Implementation of a matrix and operations on matrices.
bool parseBoolean(std::string &input)
Implements a 3D polygon with render functionnalities like clipping.
Class that defines generic functionnalities for display.
virtual void setNbPoint(const unsigned int nb)
unsigned int nbLines
Number of lines in CAO model.
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
virtual void extractCylinders(SoVRMLIndexedFaceSet *face_set, vpHomogeneousMatrix &transform, int &idFace, const std::string &polygonName="")
unsigned int getWidth() const
vpPoint getGravityCenter(const std::vector< vpPoint > &_pts) const
std::map< std::string, std::string > parseParameters(std::string &endLine)
unsigned int nbCircles
Number of circles in CAO model.
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
void setNearClippingDistance(const double &dist)
Implementation of an homogeneous matrix and operations on such kind of matrices.
virtual void extractGroup(SoVRMLGroup *sceneGraphVRML2, vpHomogeneousMatrix &transform, int &idFace)
std::map< std::string, std::string > mapOfParameterNames
Map with [map.first]=parameter_names and [map.second]=type (string, number or boolean) ...
double euclideanNorm() const
unsigned int nbCylinders
Number of cylinders in CAO model.
unsigned int nbPoints
Number of points in CAO model.
Display for windows using GDI (available on any windows 32 platform).
vpHomogeneousMatrix cMo
The current pose.
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius, const int idFace=0, const std::string &name="")=0
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
bool modelInitialised
Flag used to ensure that the CAD model is loaded before the initialisation.
double get_oY() const
Get the point Y coordinate in the object frame.
void setMinPolygonAreaThresh(const double min_polygon_area)
error that can be emited by ViSP classes.
void set_x(const double x)
Set the point x coordinate in the image plane.
virtual void loadCAOModel(const std::string &modelFile, std::vector< std::string > &vectorOfModelFilename, int &startIdFace, const bool verbose=false, const bool parent=true)
static void displayPoint(const vpImage< unsigned char > &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Point coordinates conversion from pixel coordinates to normalized coordinates in meter...
void setName(const std::string &face_name)
Provides simple mathematics computation tools that are not available in the C mathematics library (ma...
bool useOgre
Use Ogre3d for visibility tests.
unsigned int getCols() const
Return the number of columns of the 2D array.
std::string modelFileName
The name of the file containing the model (it is used to create a file name.0.pos used to store the c...
virtual void setEstimatedDoF(const vpColVector &v)
virtual void initFromPose(const vpImage< unsigned char > &I, const std::string &initFile)
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
void setFarClippingDistance(const double &dist)
virtual void extractLines(SoVRMLIndexedLineSet *line_set, int &idFace, const std::string &polygonName="")
Class that defines what is a point.
vpCameraParameters cam
The camera parameters.
static Type maximum(const Type &a, const Type &b)
Implementation of a rotation matrix and operations on such kind of matrices.
virtual void init(const vpImage< unsigned char > &I)=0
double distFarClip
Distance for near clipping.
void computeJTR(const vpMatrix &J, const vpColVector &R, vpColVector &JTR) const
vpAROgre * getOgreContext()
Defines a generic 2D polygon.
virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name="")
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)=0
vpColVector & normalize()
vpMatrix oJo
The Degrees of Freedom to estimate.
Implementation of a polygon of the model used by the model-based tracker.
void savePose(const std::string &filename) const
static double sqr(double x)
double minLineLengthThresholdGeneral
Minimum line length threshold for LOD mode (general setting)
static void display(const vpImage< unsigned char > &I)
void createCylinderBBox(const vpPoint &p1, const vpPoint &p2, const double &radius, std::vector< std::vector< vpPoint > > &listFaces)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
void addPoint(const unsigned int n, const vpPoint &P)
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
double get_oZ() const
Get the point Z coordinate in the object frame.
void set_y(const double y)
Set the point y coordinate in the image plane.
Main methods for a model-based tracker.
bool computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
std::string & trim(std::string &s) const
virtual void loadVRMLModel(const std::string &modelFile)
Implementation of a rotation vector as quaternion angle minimal representation.
void setIsPolygonOriented(const bool &oriented)
unsigned int nbPolygonLines
Number of polygon lines in CAO model.
unsigned int getRows() const
Return the number of rows of the 2D array.
void addPolygon(PolygonType *p)
virtual void initClick(const vpImage< unsigned char > &I, const std::string &initFile, const bool displayHelp=false)
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
static double rad(double deg)
virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name="")
std::string poseSavingFilename
Filename used to save the initial pose computed using the initClick() method. It is also used to read...
unsigned int size() const
double get_oX() const
Get the point X coordinate in the object frame.
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, vpImagePoint offset=vpImagePoint(0, 0))
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
unsigned int nbPolygonPoints
Number of polygon points in CAO model.
double minPolygonAreaThresholdGeneral
Minimum polygon area threshold for LOD mode (general setting)
virtual void setOgreVisibilityTest(const bool &v)
void setWorldCoordinates(const double oX, const double oY, const double oZ)
virtual void loadModel(const char *modelFile, const bool verbose=false)
int getWindowYPosition() const
static void read(vpImage< unsigned char > &I, const std::string &filename)
bool applyLodSettingInConfig
True if the CAO model is loaded before the call to loadConfigFile, (deduced by the number of polygons...
Implementation of column vector and the associated operations.
void setLod(const bool use_lod)
virtual void initFaceFromLines(vpMbtPolygon &polygon)=0
Implementation of a pose vector and operations on poses.
error that can be emited by the vpMatrix class and its derivates
vpPoseVector buildFrom(const double tx, const double ty, const double tz, const double tux, const double tuy, const double tuz)
virtual void setClipping(const unsigned int &flags)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void addPolygon(const std::vector< vpPoint > &corners, const int idFace=-1, const std::string &polygonName="", const bool useLod=false, const double minPolygonAreaThreshold=2500.0, const double minLineLengthThreshold=50.0)
static vpColVector crossProd(const vpColVector &a, const vpColVector &b)
This class defines the container for a plane geometrical structure.
unsigned int clippingFlag
Flags specifying which clipping to used.
virtual void initFromPoints(const vpImage< unsigned char > &I, const std::string &initFile)
virtual void setFarClippingDistance(const double &dist)
void addPoint(const vpPoint &P)
double distNearClip
Distance for near clipping.
bool useLodGeneral
True if LOD mode is enabled.
virtual void extractFaces(SoVRMLIndexedFaceSet *face_set, vpHomogeneousMatrix &transform, int &idFace, const std::string &polygonName="")
Class that consider the case of a translation vector.
bool isoJoIdentity
Boolean to know if oJo is identity (for fast computation)
virtual std::pair< std::vector< vpPolygon >, std::vector< std::vector< vpPoint > > > getPolygonFaces(const bool orderPolygons=true, const bool useVisibility=true, const bool clipPolygon=false)
void removeComment(std::ifstream &fileId)
double computeResidual(const vpHomogeneousMatrix &cMo) const
Compute and return the residual expressed in meter for the pose matrix 'cMo'.
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace=0, const std::string &name="")=0
void setMinLineLengthThresh(const double min_line_length)
int getWindowXPosition() const
void resize(const unsigned int i, const bool flagNullify=true)
std::vector< PolygonType * > & getPolygon()
virtual void setIndex(const int i)
virtual void setLod(const bool useLod, const std::string &name="")
virtual void setNearClippingDistance(const double &dist)