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
98 SegmentInfo() : extremities(), name(), useLod(false), minLineLengthThresh(0.) {}
100 std::vector<vpPoint> extremities;
103 double minLineLengthThresh;
110 struct PolygonFaceInfo {
111 PolygonFaceInfo(
const double dist,
const vpPolygon &poly,
const std::vector<vpPoint> &corners)
112 : distanceToCamera(dist), polygon(poly), faceCorners(corners) {}
114 bool operator<(
const PolygonFaceInfo &pfi)
const {
115 return distanceToCamera < pfi.distanceToCamera;
118 double distanceToCamera;
120 std::vector<vpPoint> faceCorners;
122 #endif // DOXYGEN_SHOULD_SKIP_THIS
130 : cam(), cMo(), oJo(6,6), isoJoIdentity(true), modelFileName(), modelInitialised(false),
131 poseSavingFilename(), computeCovariance(false), covarianceMatrix(), computeProjError(false),
132 projectionError(90.0), displayFeatures(false), m_w(), m_error(), m_optimizationMethod(
vpMbTracker::GAUSS_NEWTON_OPT),
133 faces(), angleAppears(
vpMath::rad(89) ), angleDisappears(
vpMath::rad(89) ), distNearClip(0.001),
134 distFarClip(100), clippingFlag(
vpPolygon3D::NO_CLIPPING), useOgre(false), ogreShowConfigDialog(false), useScanLine(false),
135 nbPoints(0), nbLines(0), nbPolygonLines(0), nbPolygonPoints(0), nbCylinders(0), nbCircles(0),
136 useLodGeneral(false), applyLodSettingInConfig(false), minLineLengthThresholdGeneral(50.0),
137 minPolygonAreaThresholdGeneral(2500.0), mapOfParameterNames()
155 #ifdef VISP_HAVE_MODULE_GUI
186 std::string ext =
".init";
187 std::string str_pose =
"";
188 size_t pos = (
unsigned int)initFile.rfind(ext);
191 std::fstream finitpos ;
193 char s[FILENAME_MAX];
195 if( pos == initFile.size()-ext.size() && pos != 0)
196 str_pose = initFile.substr(0,pos) +
".0.pos";
198 str_pose = initFile +
".0.pos";
200 finitpos.open(str_pose.c_str() ,std::ios::in) ;
201 sprintf(s,
"%s", str_pose.c_str());
206 if(finitpos.fail() ){
207 std::cout <<
"cannot read " << s << std::endl <<
"cMo set to identity" << std::endl;
211 for (
unsigned int i = 0; i < 6; i += 1){
212 finitpos >> init_pos[i];
218 std::cout <<
"last_cMo : "<<std::endl << last_cMo <<std::endl;
225 std::cout <<
"No modification : left click " << std::endl;
226 std::cout <<
"Modify initial pose : right click " << std::endl ;
229 "left click to validate, right click to modify initial pose",
259 if( pos == initFile.size()-ext.size() && pos != 0)
260 sprintf(s,
"%s", initFile.c_str());
262 sprintf(s,
"%s.init", initFile.c_str());
264 std::cout <<
"Load 3D points from: " << s << std::endl ;
265 finit.open(s,std::ios::in) ;
267 std::cout <<
"cannot read " << s << std::endl;
271 #ifdef VISP_HAVE_MODULE_IO
276 if( pos == initFile.size()-ext.size() && pos != 0)
277 dispF = initFile.substr(0,pos) +
".ppm";
279 dispF = initFile +
".ppm";
282 std::cout <<
"Load image to help initialization: " << dispF << std::endl;
283 #if defined VISP_HAVE_X11
285 #elif defined VISP_HAVE_GDI
287 #elif defined VISP_HAVE_OPENCV
293 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
295 "Where to initialize...") ;
308 #else //#ifdef VISP_HAVE_MODULE_IO
310 #endif //#ifdef VISP_HAVE_MODULE_IO
314 while (!finit.fail() && (c ==
'#')) {
315 finit.ignore(256,
'\n');
322 finit.ignore(256,
'\n');
323 std::cout <<
"Number of 3D points " << n << std::endl ;
326 "Exceed the max number of points.");
330 for (
unsigned int i=0 ; i < n ; i++){
333 while (!finit.fail() && (c ==
'#')) {
334 finit.ignore(256,
'\n');
342 finit.ignore(256,
'\n');
344 std::cout <<
"Point " << i+1 <<
" with 3D coordinates: " << X <<
" " << Y <<
" " << Z << std::endl;
351 bool isWellInit =
false;
355 std::vector<vpImagePoint> mem_ip;
356 for(
unsigned int i=0 ; i< n ; i++)
358 std::ostringstream text;
359 text <<
"Click on point " << i+1;
362 for (
unsigned int k=0; k<mem_ip.size(); k++) {
367 std::cout <<
"Click on point " << i+1 <<
" ";
370 mem_ip.push_back(ip);
376 std::cout <<
"with 2D coordinates: " << ip << std::endl;
399 "left click to validate, right click to re initialize object",
436 std::cout <<
"cMo : "<<std::endl <<
cMo <<std::endl;
451 const std::string &displayFile)
458 std::vector<vpPoint> P;
459 for (
unsigned int i=0 ; i < points3D_list.size() ; i++)
460 P.push_back(
vpPoint(points3D_list[i].get_oX(), points3D_list[i].get_oY(), points3D_list[i].get_oZ()) );
462 #ifdef VISP_HAVE_MODULE_IO
467 std::cout <<
"Load image to help initialization: " << displayFile << std::endl;
468 #if defined VISP_HAVE_X11
470 #elif defined VISP_HAVE_GDI
472 #elif defined VISP_HAVE_OPENCV
477 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
479 "Where to initialize...") ;
491 #else //#ifdef VISP_HAVE_MODULE_IO
493 #endif //#ifdef VISP_HAVE_MODULE_IO
496 bool isWellInit =
false;
499 for(
unsigned int i=0 ; i< points3D_list.size() ; i++)
501 std::cout <<
"Click on point " << i+1 << std::endl ;
510 std::cout <<
"Click on point " << ip << std::endl;
533 "left click to validate, right click to re initialize object",
562 #endif //#ifdef VISP_HAVE_MODULE_GUI
583 char s[FILENAME_MAX];
586 std::string ext =
".init";
587 size_t pos = initFile.rfind(ext);
589 if( pos == initFile.size()-ext.size() && pos != 0)
590 sprintf(s,
"%s", initFile.c_str());
592 sprintf(s,
"%s.init", initFile.c_str());
594 std::cout <<
"filename " << s << std::endl ;
595 finit.open(s,std::ios::in) ;
597 std::cout <<
"cannot read " << s << std::endl;
604 std::cout <<
"number of points " << size << std::endl ;
608 "Exceed the max number of points.");
614 for(
unsigned int i=0 ; i< size ; i++)
627 vpERROR_TRACE(
"vpMbTracker::initFromPoints(), Number of 2D points different to the number of 3D points." );
629 for(
unsigned int i=0 ; i< size ; i++)
667 const std::vector<vpPoint> &points3D_list )
669 if(points2D_list.size() != points3D_list.size())
670 vpERROR_TRACE(
"vpMbTracker::initFromPoints(), Number of 2D points different to the number of 3D points." );
672 size_t size = points3D_list.size();
673 std::vector<vpPoint> P;
676 for(
size_t i=0 ; i< size ; i++)
678 P.push_back(
vpPoint(points3D_list[i].get_oX(), points3D_list[i].get_oY(), points3D_list[i].get_oZ()) );
721 char s[FILENAME_MAX];
725 std::string ext =
".pos";
726 size_t pos = initFile.rfind(ext);
728 if( pos == initFile.size()-ext.size() && pos != 0)
729 sprintf(s,
"%s", initFile.c_str());
731 sprintf(s,
"%s.pos", initFile.c_str());
733 finit.open(s,std::ios::in) ;
735 std::cout <<
"cannot read " << s << std::endl;
739 for (
unsigned int i = 0; i < 6; i += 1){
740 finit >> init_pos[i];
779 std::fstream finitpos ;
780 char s[FILENAME_MAX];
782 sprintf(s,
"%s", filename.c_str());
783 finitpos.open(s, std::ios::out) ;
786 finitpos << init_pos;
792 const bool useLod,
const double minPolygonAreaThreshold,
const double minLineLengthThreshold)
794 std::vector<vpPoint> corners_without_duplicates;
795 corners_without_duplicates.push_back(corners[0]);
796 for (
unsigned int i=0; i < corners.size()-1; i++) {
797 if (std::fabs(corners[i].get_oX() - corners[i+1].get_oX()) > std::fabs(corners[i].get_oX())*std::numeric_limits<double>::epsilon()
798 || std::fabs(corners[i].get_oY() - corners[i+1].get_oY()) > std::fabs(corners[i].get_oY())*std::numeric_limits<double>::epsilon()
799 || std::fabs(corners[i].get_oZ() - corners[i+1].get_oZ()) > std::fabs(corners[i].get_oZ())*std::numeric_limits<double>::epsilon()) {
800 corners_without_duplicates.push_back(corners[i+1]);
805 polygon.
setNbPoint((
unsigned int)corners_without_duplicates.size());
823 for(
unsigned int j = 0; j < corners_without_duplicates.size(); j++) {
824 polygon.
addPoint(j, corners_without_duplicates[j]);
840 const int idFace,
const std::string &polygonName,
const bool useLod,
const double minPolygonAreaThreshold)
874 y[0] = plane.
getA() / norm_Y;
875 y[1] = plane.
getB() / norm_Y;
876 y[2] = plane.
getC() / norm_Y;
879 for (
unsigned int i=0; i< 3; i++) {
895 for(
unsigned int i=0; i<4; i++) {
898 w_p = wMc * cMc_90 * c_p;
921 const bool useLod,
const double minLineLengthThreshold)
955 void vpMbTracker::addPolygon(
const std::vector<std::vector<vpPoint> > &listFaces,
const int idFace,
const std::string &polygonName,
956 const bool useLod,
const double minLineLengthThreshold)
959 for(
unsigned int i = 0 ; i < listFaces.size() ; i++)
962 polygon.
setNbPoint((
unsigned int)listFaces[i].size());
963 for(
unsigned int j = 0 ; j < listFaces[i].size() ; j++)
964 polygon.
addPoint(j, listFaces[i][j]);
1016 loadModel( std::string(modelFile), verbose );
1047 std::string::const_iterator it;
1050 it = modelFile.end();
1051 if((*(it-1) ==
'o' && *(it-2) ==
'a' && *(it-3) ==
'c' && *(it-4) ==
'.') ||
1052 (*(it-1) ==
'O' && *(it-2) ==
'A' && *(it-3) ==
'C' && *(it-4) ==
'.') ){
1053 std::vector<std::string> vectorOfModelFilename;
1061 loadCAOModel(modelFile, vectorOfModelFilename, startIdFace, verbose,
true);
1063 else if((*(it-1) ==
'l' && *(it-2) ==
'r' && *(it-3) ==
'w' && *(it-4) ==
'.') ||
1064 (*(it-1) ==
'L' && *(it-2) ==
'R' && *(it-3) ==
'W' && *(it-4) ==
'.') ){
1113 #ifdef VISP_HAVE_COIN3D
1117 SbBool ok = in.openFile(modelFile.c_str());
1118 SoSeparator *sceneGraph;
1119 SoVRMLGroup *sceneGraphVRML2;
1126 if(!in.isFileVRML2())
1128 sceneGraph = SoDB::readAll(&in);
1129 if (sceneGraph == NULL) { }
1132 SoToVRML2Action tovrml2;
1133 tovrml2.apply(sceneGraph);
1135 sceneGraphVRML2 =tovrml2.getVRML2SceneGraph();
1136 sceneGraphVRML2->ref();
1137 sceneGraph->unref();
1141 sceneGraphVRML2 = SoDB::readAllVRML(&in);
1142 if (sceneGraphVRML2 == NULL) { }
1143 sceneGraphVRML2->ref();
1152 sceneGraphVRML2->unref();
1154 vpERROR_TRACE(
"coin not detected with ViSP, cannot load model : %s", modelFile.c_str());
1163 while (!fileId.fail() && (c ==
'#')) {
1164 fileId.ignore(256,
'\n');
1173 std::map<std::string, std::string> mapOfParams;
1176 while (!endLine.empty() && !exit) {
1179 for (std::map<std::string, std::string>::const_iterator it =
1182 endLine =
trim(endLine);
1184 std::string param(it->first +
"=");
1187 if (endLine.compare(0, param.size(), param) == 0) {
1189 endLine = endLine.substr(param.size());
1191 bool parseQuote =
false;
1192 if (it->second ==
"string") {
1194 if (endLine.size() > 2 && endLine[0] ==
'"') {
1196 endLine = endLine.substr(1);
1197 size_t pos = endLine.find_first_of(
'"');
1199 if (pos != std::string::npos) {
1200 mapOfParams[it->first] = endLine.substr(0, pos);
1201 endLine = endLine.substr(pos + 1);
1211 size_t pos1 = endLine.find_first_of(
' ');
1212 size_t pos2 = endLine.find_first_of(
'\t');
1213 size_t pos = pos1 < pos2 ? pos1 : pos2;
1215 mapOfParams[it->first] = endLine.substr(0, pos);
1216 endLine = endLine.substr(pos + 1);
1276 std::vector<std::string>& vectorOfModelFilename,
int& startIdFace,
1277 const bool verbose,
const bool parent) {
1278 std::ifstream fileId;
1279 fileId.exceptions(std::ifstream::failbit | std::ifstream::eofbit);
1280 fileId.open(modelFile.c_str(), std::ifstream::in);
1281 if (fileId.fail()) {
1282 std::cout <<
"cannot read CAO model file: " << modelFile << std::endl;
1287 std::cout <<
"Model file : " << modelFile << std::endl;
1289 vectorOfModelFilename.push_back(modelFile);
1302 fileId >> caoVersion;
1303 fileId.ignore(256,
'\n');
1306 <<
"in vpMbTracker::loadCAOModel() -> Bad parameter header file : use V0, V1, ...";
1308 "in vpMbTracker::loadCAOModel() -> Bad parameter header file : use V0, V1, ...");
1316 std::string prefix =
"load";
1320 bool header =
false;
1321 while(c ==
'l' || c ==
'L') {
1324 getline(fileId, line);
1325 if(!line.compare(0, prefix.size(), prefix)) {
1328 std::string headerPathname = line.substr(6);
1329 size_t firstIndex = headerPathname.find_first_of(
"\")");
1330 headerPathname = headerPathname.substr(0, firstIndex);
1332 std::string headerPath = headerPathname;
1338 bool cyclic =
false;
1344 for (std::vector<std::string>::const_iterator it =
1345 vectorOfModelFilename.begin();
1346 it != vectorOfModelFilename.end() - 1 && !cyclic;
1349 if (!headerModelFilename.compare(loadedModelFilename)) {
1356 loadCAOModel(headerPath, vectorOfModelFilename, startIdFace, verbose,
false);
1359 "file cannot be open");
1362 std::cout <<
"WARNING Cyclic dependency detected with file "
1363 << headerPath <<
" declared in " << modelFile << std::endl;
1376 unsigned int caoNbrPoint;
1377 fileId >> caoNbrPoint;
1378 fileId.ignore(256,
'\n');
1381 if(verbose || vectorOfModelFilename.size() == 1) {
1382 std::cout <<
"> " << caoNbrPoint <<
" points" << std::endl;
1385 if (caoNbrPoint > 100000) {
1387 "Exceed the max number of points in the CAO model.");
1390 if (caoNbrPoint == 0 && !header) {
1392 "in vpMbTracker::loadCAOModel() -> no points are defined");
1403 for (
unsigned int k = 0; k < caoNbrPoint; k++) {
1410 if (caoVersion == 2) {
1415 fileId.ignore(256,
'\n');
1426 std::map<std::pair<unsigned int, unsigned int>, SegmentInfo > segmentTemporaryMap;
1427 unsigned int caoNbrLine;
1428 fileId >> caoNbrLine;
1429 fileId.ignore(256,
'\n');
1432 unsigned int *caoLinePoints = NULL;
1433 if(verbose || vectorOfModelFilename.size() == 1) {
1434 std::cout <<
"> " << caoNbrLine <<
" lines" << std::endl;
1437 if (caoNbrLine > 100000) {
1440 "Exceed the max number of lines in the CAO model.");
1444 caoLinePoints =
new unsigned int[2 * caoNbrLine];
1446 unsigned int index1, index2;
1448 int idFace = startIdFace;
1450 for (
unsigned int k = 0; k < caoNbrLine; k++) {
1459 fileId.getline(buffer, 256);
1460 std::string endLine(buffer);
1461 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1465 std::string segmentName =
"";
1468 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1469 segmentName = mapOfParams[
"name"];
1471 if(mapOfParams.find(
"minLineLengthThreshold") != mapOfParams.end()) {
1472 minLineLengthThresh = std::atof(mapOfParams[
"minLineLengthThreshold"].c_str());
1474 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1478 SegmentInfo segmentInfo;
1479 segmentInfo.name = segmentName;
1480 segmentInfo.useLod = useLod;
1481 segmentInfo.minLineLengthThresh = minLineLengthThresh;
1483 caoLinePoints[2 * k] = index1;
1484 caoLinePoints[2 * k + 1] = index2;
1486 if (index1 < caoNbrPoint && index2 < caoNbrPoint) {
1487 std::vector<vpPoint> extremities;
1488 extremities.push_back(caoPoints[index1]);
1489 extremities.push_back(caoPoints[index2]);
1490 segmentInfo.extremities = extremities;
1492 std::pair<unsigned int, unsigned int> key(index1, index2);
1494 segmentTemporaryMap[key] = segmentInfo;
1498 vpTRACE(
" line %d has wrong coordinates.", k);
1508 std::vector<std::pair<unsigned int, unsigned int> > faceSegmentKeyVector;
1509 unsigned int caoNbrPolygonLine;
1510 fileId >> caoNbrPolygonLine;
1511 fileId.ignore(256,
'\n');
1514 if(verbose || vectorOfModelFilename.size() == 1) {
1515 std::cout <<
"> " << caoNbrPolygonLine <<
" polygon lines" << std::endl;
1518 if (caoNbrPolygonLine > 100000) {
1520 delete[] caoLinePoints;
1522 "Exceed the max number of polygon lines.");
1526 for (
unsigned int k = 0; k < caoNbrPolygonLine; k++) {
1529 unsigned int nbLinePol;
1530 fileId >> nbLinePol;
1531 std::vector<vpPoint> corners;
1532 if (nbLinePol > 100000) {
1536 for (
unsigned int n = 0; n < nbLinePol; n++) {
1539 if(index >= caoNbrLine) {
1542 corners.push_back(caoPoints[caoLinePoints[2 * index]]);
1543 corners.push_back(caoPoints[caoLinePoints[2 * index + 1]]);
1545 std::pair<unsigned int, unsigned int> key(caoLinePoints[2 * index], caoLinePoints[2 * index + 1]);
1546 faceSegmentKeyVector.push_back(key);
1553 fileId.getline(buffer, 256);
1554 std::string endLine(buffer);
1555 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1559 std::string polygonName =
"";
1562 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1563 polygonName = mapOfParams[
"name"];
1565 if(mapOfParams.find(
"minPolygonAreaThreshold") != mapOfParams.end()) {
1566 minPolygonAreaThreshold = std::atof(mapOfParams[
"minPolygonAreaThreshold"].c_str());
1568 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1578 for(std::map<std::pair<unsigned int, unsigned int>, SegmentInfo >::const_iterator it =
1579 segmentTemporaryMap.begin(); it != segmentTemporaryMap.end(); ++it) {
1580 if(std::find(faceSegmentKeyVector.begin(), faceSegmentKeyVector.end(), it->first) == faceSegmentKeyVector.end()) {
1582 it->second.minLineLengthThresh);
1592 unsigned int caoNbrPolygonPoint;
1593 fileId >> caoNbrPolygonPoint;
1594 fileId.ignore(256,
'\n');
1597 if(verbose || vectorOfModelFilename.size() == 1) {
1598 std::cout <<
"> " << caoNbrPolygonPoint <<
" polygon points"
1602 if (caoNbrPolygonPoint > 100000) {
1604 "Exceed the max number of polygon point.");
1607 for (
unsigned int k = 0; k < caoNbrPolygonPoint; k++) {
1610 unsigned int nbPointPol;
1611 fileId >> nbPointPol;
1612 if (nbPointPol > 100000) {
1614 "Exceed the max number of points.");
1616 std::vector<vpPoint> corners;
1617 for (
unsigned int n = 0; n < nbPointPol; n++) {
1619 if (index > caoNbrPoint - 1) {
1621 "Exceed the max number of points.");
1623 corners.push_back(caoPoints[index]);
1630 fileId.getline(buffer, 256);
1631 std::string endLine(buffer);
1632 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1636 std::string polygonName =
"";
1639 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1640 polygonName = mapOfParams[
"name"];
1642 if(mapOfParams.find(
"minPolygonAreaThreshold") != mapOfParams.end()) {
1643 minPolygonAreaThreshold = std::atof(mapOfParams[
"minPolygonAreaThreshold"].c_str());
1645 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1655 unsigned int caoNbCylinder;
1661 delete[] caoLinePoints;
1666 fileId >> caoNbCylinder;
1667 fileId.ignore(256,
'\n');
1670 if(verbose || vectorOfModelFilename.size() == 1) {
1671 std::cout <<
"> " << caoNbCylinder <<
" cylinders" << std::endl;
1674 if (caoNbCylinder > 100000) {
1676 "Exceed the max number of cylinders.");
1679 for (
unsigned int k = 0; k < caoNbCylinder; ++k) {
1683 unsigned int indexP1, indexP2;
1691 fileId.getline(buffer, 256);
1692 std::string endLine(buffer);
1693 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1697 std::string polygonName =
"";
1700 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1701 polygonName = mapOfParams[
"name"];
1703 if(mapOfParams.find(
"minLineLengthThreshold") != mapOfParams.end()) {
1704 minLineLengthThreshold = std::atof(mapOfParams[
"minLineLengthThreshold"].c_str());
1706 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1710 int idRevolutionAxis = idFace;
1711 addPolygon(caoPoints[indexP1], caoPoints[indexP2], idFace++, polygonName, useLod, minLineLengthThreshold);
1713 std::vector<std::vector<vpPoint> > listFaces;
1715 addPolygon(listFaces, idFace, polygonName, useLod, minLineLengthThreshold);
1718 initCylinder(caoPoints[indexP1], caoPoints[indexP2], radius, idRevolutionAxis, polygonName);
1723 <<
"Cannot get the number of cylinders. Defaulting to zero."
1730 unsigned int caoNbCircle;
1736 delete[] caoLinePoints;
1741 fileId >> caoNbCircle;
1742 fileId.ignore(256,
'\n');
1745 if(verbose || vectorOfModelFilename.size() == 1) {
1746 std::cout <<
"> " << caoNbCircle <<
" circles" << std::endl;
1749 if (caoNbCircle > 100000) {
1751 "Exceed the max number of cicles.");
1754 for (
unsigned int k = 0; k < caoNbCircle; ++k) {
1758 unsigned int indexP1, indexP2, indexP3;
1767 fileId.getline(buffer, 256);
1768 std::string endLine(buffer);
1769 std::map<std::string, std::string> mapOfParams =
parseParameters(endLine);
1773 std::string polygonName =
"";
1776 if(mapOfParams.find(
"name") != mapOfParams.end()) {
1777 polygonName = mapOfParams[
"name"];
1779 if(mapOfParams.find(
"minPolygonAreaThreshold") != mapOfParams.end()) {
1780 minPolygonAreaThreshold = std::atof(mapOfParams[
"minPolygonAreaThreshold"].c_str());
1782 if(mapOfParams.find(
"useLod") != mapOfParams.end()) {
1786 addPolygon(caoPoints[indexP1], caoPoints[indexP2],
1787 caoPoints[indexP3], radius, idFace, polygonName, useLod, minPolygonAreaThreshold);
1789 initCircle(caoPoints[indexP1], caoPoints[indexP2],
1790 caoPoints[indexP3], radius, idFace++, polygonName);
1794 std::cerr <<
"Cannot get the number of circles. Defaulting to zero."
1799 startIdFace = idFace;
1802 delete[] caoLinePoints;
1804 if(vectorOfModelFilename.size() > 1 && parent) {
1806 std::cout <<
"Global information for " <<
vpIoTools::getName(modelFile) <<
" :" << std::endl;
1807 std::cout <<
"Total nb of points : " <<
nbPoints << std::endl;
1808 std::cout <<
"Total nb of lines : " <<
nbLines << std::endl;
1809 std::cout <<
"Total nb of polygon lines : " <<
nbPolygonLines << std::endl;
1810 std::cout <<
"Total nb of polygon points : " <<
nbPolygonPoints << std::endl;
1811 std::cout <<
"Total nb of cylinders : " <<
nbCylinders << std::endl;
1812 std::cout <<
"Total nb of circles : " <<
nbCircles << std::endl;
1814 std::cout <<
"> " <<
nbPoints <<
" points" << std::endl;
1815 std::cout <<
"> " <<
nbLines <<
" lines" << std::endl;
1816 std::cout <<
"> " <<
nbPolygonLines <<
" polygon lines" << std::endl;
1817 std::cout <<
"> " <<
nbPolygonPoints <<
" polygon points" << std::endl;
1818 std::cout <<
"> " <<
nbCylinders <<
" cylinders" << std::endl;
1819 std::cout <<
"> " <<
nbCircles <<
" circles" << std::endl;
1823 std::cerr <<
"Cannot read line!" << std::endl;
1828 #ifdef VISP_HAVE_COIN3D
1840 SoVRMLTransform *sceneGraphVRML2Trasnform =
dynamic_cast<SoVRMLTransform *
>(sceneGraphVRML2);
1841 if(sceneGraphVRML2Trasnform){
1842 float rx, ry, rz, rw;
1843 sceneGraphVRML2Trasnform->rotation.getValue().getValue(rx,ry,rz,rw);
1848 tx = sceneGraphVRML2Trasnform->translation.getValue()[0];
1849 ty = sceneGraphVRML2Trasnform->translation.getValue()[1];
1850 tz = sceneGraphVRML2Trasnform->translation.getValue()[2];
1855 sx = sceneGraphVRML2Trasnform->scale.getValue()[0];
1856 sy = sceneGraphVRML2Trasnform->scale.getValue()[1];
1857 sz = sceneGraphVRML2Trasnform->scale.getValue()[2];
1860 for(
unsigned int i = 0 ; i < 3 ; i++)
1862 for(
unsigned int i = 0 ; i < 3 ; i++)
1864 for(
unsigned int i = 0 ; i < 3 ; i++)
1868 transform = transform * transformCur;
1871 int nbShapes = sceneGraphVRML2->getNumChildren();
1877 for (
int i = 0; i < nbShapes; i++)
1880 child = sceneGraphVRML2->getChild(i);
1882 if (child->getTypeId() == SoVRMLGroup::getClassTypeId()){
1883 extractGroup((SoVRMLGroup*)child, transform_recursive, idFace);
1886 if (child->getTypeId() == SoVRMLTransform::getClassTypeId()){
1887 extractGroup((SoVRMLTransform*)child, transform_recursive, idFace);
1890 if (child->getTypeId() == SoVRMLShape::getClassTypeId()){
1891 SoChildList * child2list = child->getChildren();
1892 std::string name = child->getName().getString();
1894 for (
int j = 0; j < child2list->getLength(); j++)
1896 if (((SoNode*)child2list->get(j))->getTypeId() == SoVRMLIndexedFaceSet::getClassTypeId())
1898 SoVRMLIndexedFaceSet * face_set;
1899 face_set = (SoVRMLIndexedFaceSet*)child2list->get(j);
1900 if(!strncmp(face_set->getName().getString(),
"cyl",3)){
1906 if (((SoNode*)child2list->get(j))->getTypeId() == SoVRMLIndexedLineSet::getClassTypeId())
1908 SoVRMLIndexedLineSet * line_set;
1909 line_set = (SoVRMLIndexedLineSet*)child2list->get(j);
1929 std::vector<vpPoint> corners;
1934 int indexListSize = face_set->coordIndex.getNum();
1938 SoVRMLCoordinate *coord;
1940 for (
int i = 0; i < indexListSize; i++)
1942 if (face_set->coordIndex[i] == -1)
1944 if(corners.size() > 1)
1953 coord = (SoVRMLCoordinate *)(face_set->coord.getValue());
1954 int index = face_set->coordIndex[i];
1955 pointTransformed[0]=coord->point[index].getValue()[0];
1956 pointTransformed[1]=coord->point[index].getValue()[1];
1957 pointTransformed[2]=coord->point[index].getValue()[2];
1958 pointTransformed[3] = 1.0;
1960 pointTransformed = transform * pointTransformed;
1963 corners.push_back(pt);
1985 std::vector<vpPoint> corners_c1, corners_c2;
1986 SoVRMLCoordinate* coords = (SoVRMLCoordinate *)face_set->coord.getValue();
1988 unsigned int indexListSize = (
unsigned int)coords->point.getNum();
1990 if(indexListSize % 2 == 1){
1991 std::cout <<
"Not an even number of points when extracting a cylinder." << std::endl;
1994 corners_c1.resize(indexListSize / 2);
1995 corners_c2.resize(indexListSize / 2);
2002 for(
int i=0; i<coords->point.getNum(); ++i){
2003 pointTransformed[0]=coords->point[i].getValue()[0];
2004 pointTransformed[1]=coords->point[i].getValue()[1];
2005 pointTransformed[2]=coords->point[i].getValue()[2];
2006 pointTransformed[3] = 1.0;
2008 pointTransformed = transform * pointTransformed;
2012 if(i < (
int)corners_c1.size()){
2013 corners_c1[(
unsigned int)i] = pt;
2015 corners_c2[(
unsigned int)i-corners_c1.size()] = pt;
2023 dist[0] = p1.
get_oX() - corners_c1[0].get_oX();
2024 dist[1] = p1.
get_oY() - corners_c1[0].get_oY();
2025 dist[2] = p1.
get_oZ() - corners_c1[0].get_oZ();
2026 double radius_c1 = sqrt(dist.
sumSquare());
2027 dist[0] = p2.
get_oX() - corners_c2[0].get_oX();
2028 dist[1] = p2.
get_oY() - corners_c2[0].get_oY();
2029 dist[2] = p2.
get_oZ() - corners_c2[0].get_oZ();
2030 double radius_c2 = sqrt(dist.sumSquare());
2032 if(std::fabs(radius_c1 - radius_c2) > (std::numeric_limits<double>::epsilon() *
vpMath::maximum(radius_c1, radius_c2))){
2033 std::cout <<
"Radius from the two circles of the cylinders are different." << std::endl;
2040 int idRevolutionAxis = idFace;
2043 std::vector<std::vector<vpPoint> > listFaces;
2048 initCylinder(p1, p2, radius_c1, idRevolutionAxis, polygonName);
2062 std::vector<vpPoint> corners;
2065 int indexListSize = line_set->coordIndex.getNum();
2067 SbVec3f point(0,0,0);
2069 SoVRMLCoordinate *coord;
2071 for (
int i = 0; i < indexListSize; i++)
2073 if (line_set->coordIndex[i] == -1)
2075 if(corners.size() > 1)
2084 coord = (SoVRMLCoordinate *)(line_set->coord.getValue());
2085 int index = line_set->coordIndex[i];
2086 point[0]=coord->point[index].getValue()[0];
2087 point[1]=coord->point[index].getValue()[1];
2088 point[2]=coord->point[index].getValue()[2];
2091 corners.push_back(pt);
2096 #endif // VISP_HAVE_COIN3D
2111 std::cout <<
"Cannot extract center of gravity of empty set." << std::endl;
2119 for(
unsigned int i=0; i<pts.size(); ++i){
2121 oY += pts[i].get_oY();
2122 oZ += pts[i].get_oZ();
2138 std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > >
2142 std::vector<vpPolygon> polygonsTmp;
2143 std::vector<std::vector<vpPoint> > roisPtTmp;
2146 std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > > pairOfPolygonFaces;
2149 std::vector<vpImagePoint> roi;
2150 std::vector<vpPoint> roiPt;
2153 if((useVisibility &&
getPolygon(i)->isvisible) || !useVisibility) {
2157 double u = 0, v = 0;
2160 roiPt.push_back(pt);
2164 roisPtTmp.push_back(roiPt);
2171 std::vector<PolygonFaceInfo> listOfPolygonFaces;
2172 for(
unsigned int i = 0; i < polygonsTmp.size(); i++) {
2173 double x_centroid = 0.0, y_centroid = 0.0, z_centroid = 0.0;
2174 for(
unsigned int j = 0; j < roisPtTmp[i].size(); j++) {
2175 x_centroid += roisPtTmp[i][j].get_X();
2176 y_centroid += roisPtTmp[i][j].get_Y();
2177 z_centroid += roisPtTmp[i][j].get_Z();
2180 x_centroid /= roisPtTmp[i].size();
2181 y_centroid /= roisPtTmp[i].size();
2182 z_centroid /= roisPtTmp[i].size();
2184 double squared_dist = x_centroid*x_centroid + y_centroid*y_centroid + z_centroid*z_centroid;
2185 listOfPolygonFaces.push_back(PolygonFaceInfo(squared_dist, polygonsTmp[i], roisPtTmp[i]));
2189 std::sort(listOfPolygonFaces.begin(), listOfPolygonFaces.end());
2191 polygonsTmp.resize(listOfPolygonFaces.size());
2192 roisPtTmp.resize(listOfPolygonFaces.size());
2195 for(std::vector<PolygonFaceInfo>::const_iterator it = listOfPolygonFaces.begin(); it != listOfPolygonFaces.end();
2197 polygonsTmp[cpt] = it->polygon;
2198 roisPtTmp[cpt] = it->faceCorners;
2201 pairOfPolygonFaces.first = polygonsTmp;
2202 pairOfPolygonFaces.second = roisPtTmp;
2204 pairOfPolygonFaces.first = polygonsTmp;
2205 pairOfPolygonFaces.second = roisPtTmp;
2208 return pairOfPolygonFaces;
2223 #ifndef VISP_HAVE_OGRE
2225 std::cout <<
"WARNING: ViSP doesn't have Ogre3D, basic visibility test will be used. setOgreVisibilityTest() set to false." << std::endl;
2239 vpTRACE(
"Far clipping value cannot be inferior than near clipping value. Far clipping won't be considered.");
2240 else if ( dist < 0 )
2241 vpTRACE(
"Far clipping value cannot be inferior than 0. Far clipping won't be considered.");
2245 for (
unsigned int i = 0; i <
faces.
size(); i ++){
2248 #ifdef VISP_HAVE_OGRE
2266 for (
unsigned int i = 0; i <
faces.
size(); i++)
2268 if(name.empty() ||
faces[i]->name == name) {
2269 faces[i]->setLod(useLod);
2285 for (
unsigned int i = 0; i <
faces.
size(); i++)
2287 if(name.empty() ||
faces[i]->name == name) {
2288 faces[i]->setMinLineLengthThresh(minLineLengthThresh);
2304 for (
unsigned int i = 0; i <
faces.
size(); i++)
2306 if(name.empty() ||
faces[i]->name == name) {
2307 faces[i]->setMinPolygonAreaThresh(minPolygonAreaThresh);
2321 vpTRACE(
"Near clipping value cannot be superior than far clipping value. Near clipping won't be considered.");
2322 else if ( dist < 0 )
2323 vpTRACE(
"Near clipping value cannot be inferior than 0. Near clipping won't be considered.");
2327 for (
unsigned int i = 0; i <
faces.
size(); i ++){
2330 #ifdef VISP_HAVE_OGRE
2347 for (
unsigned int i = 0; i <
faces.
size(); i ++)
2370 "Incorrect matrices size in computeJTR.");
2374 const unsigned int N = interaction.
getRows();
2376 for (
unsigned int i = 0; i < 6; i += 1){
2378 for (
unsigned int j = 0; j < N; j += 1){
2379 ssum += interaction[j][i] * error[j];
2400 for(
unsigned int i = 0 ; i < 6 ; i++)
2421 for(
unsigned int i = 0 ; i < 6 ; i++){
2423 if(std::fabs(v[i]) > std::numeric_limits<double>::epsilon()){
2458 if(axisOrtho.
euclideanNorm() < std::numeric_limits<double>::epsilon())
2463 if(axisOrtho.
euclideanNorm() < std::numeric_limits<double>::epsilon())
2468 if(axisOrtho.
euclideanNorm() < std::numeric_limits<double>::epsilon())
2498 std::vector<vpPoint> pointsFace;
2499 pointsFace.push_back(
vpPoint(fc1[0], fc1[1], fc1[2]) );
2500 pointsFace.push_back(
vpPoint(sc1[0], sc1[1], sc1[2]) );
2501 pointsFace.push_back(
vpPoint(sc2[0], sc2[1], sc2[2]) );
2502 pointsFace.push_back(
vpPoint(fc2[0], fc2[1], fc2[2]) );
2503 listFaces.push_back(pointsFace);
2506 pointsFace.push_back(
vpPoint(fc2[0], fc2[1], fc2[2]) );
2507 pointsFace.push_back(
vpPoint(sc2[0], sc2[1], sc2[2]) );
2508 pointsFace.push_back(
vpPoint(sc3[0], sc3[1], sc3[2]) );
2509 pointsFace.push_back(
vpPoint(fc3[0], fc3[1], fc3[2]) );
2510 listFaces.push_back(pointsFace);
2513 pointsFace.push_back(
vpPoint(fc3[0], fc3[1], fc3[2]) );
2514 pointsFace.push_back(
vpPoint(sc3[0], sc3[1], sc3[2]) );
2515 pointsFace.push_back(
vpPoint(sc4[0], sc4[1], sc4[2]) );
2516 pointsFace.push_back(
vpPoint(fc4[0], fc4[1], fc4[2]) );
2517 listFaces.push_back(pointsFace);
2520 pointsFace.push_back(
vpPoint(fc4[0], fc4[1], fc4[2]) );
2521 pointsFace.push_back(
vpPoint(sc4[0], sc4[1], sc4[2]) );
2522 pointsFace.push_back(
vpPoint(sc1[0], sc1[1], sc1[2]) );
2523 pointsFace.push_back(
vpPoint(fc1[0], fc1[1], fc1[2]) );
2524 listFaces.push_back(pointsFace);
Implementation of a matrix and operations on matrices.
bool parseBoolean(std::string &input)
std::string & trim(std::string &s)
Implements a 3D polygon with render functionnalities like clipping.
virtual void init(vpImage< unsigned char > &I, int x=-1, int y=-1, const char *title=NULL)=0
Class that defines generic functionnalities for display.
virtual void setNbPoint(const unsigned int nb)
unsigned int nbLines
Number of lines in CAO model.
virtual void extractCylinders(SoVRMLIndexedFaceSet *face_set, vpHomogeneousMatrix &transform, int &idFace, const std::string &polygonName="")
unsigned int getWidth() 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.
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
unsigned int nbPoints
Number of points in CAO model.
Display for windows using GDI (available on any windows 32 platform).
vpPoint getGravityCenter(const std::vector< vpPoint > &_pts)
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)
Define the X11 console to display images.
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 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.
double get_y() const
Get the point y coordinate in the image plane.
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.
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.
static double sqr(double x)
void savePose(const std::string &filename)
double minLineLengthThresholdGeneral
Minimum line length threshold for LOD mode (general setting)
bool computePose(vpPoseMethodType methode, vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
compute the pose for a given method
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.
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
void addPoint(const unsigned int n, const vpPoint &P)
Class used for pose computation from N points (pose from point only).
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.
virtual void loadVRMLModel(const std::string &modelFile)
Implementation of a rotation vector as quaternion angle minimal representation.
double get_x() const
Get the point x coordinate in the image plane.
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="")
virtual vpColVector getEstimatedDoF()
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
void computeJTR(const vpMatrix &J, const vpColVector &R, vpColVector &JTR)
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))
unsigned int nbPolygonPoints
Number of polygon points in CAO model.
unsigned int nbpt
Number of points used to define the polygon.
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
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.
virtual vpMbtPolygon * getPolygon(const unsigned int index)
error that can be emited by the vpMatrix class and its derivates
virtual unsigned int getNbPolygon() const
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)
virtual bool getClick(bool blocking=true)=0
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)
static void read(vpImage< unsigned char > &I, const char *filename)
virtual void setFarClippingDistance(const double &dist)
virtual std::pair< std::vector< vpPolygon >, std::vector< std::vector< vpPoint > > > getPolygonFaces(const bool orderPolygons=true, const bool useVisibility=true)
void addPoint(const vpPoint &P)
Add a new point in this array.
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.
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
bool isoJoIdentity
Boolean to know if oJo is identity (for fast computation)
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)
void clearPoint()
suppress all the point in the array of point
virtual void setLod(const bool useLod, const std::string &name="")
virtual void setNearClippingDistance(const double &dist)