StrColParams.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2013, Fraunhofer FKIE
00003  *
00004  * Authors: Bastian Gaspers
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are met:
00008  *
00009  * * Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * * Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * * Neither the name of the Fraunhofer FKIE nor the names of its
00015  *   contributors may be used to endorse or promote products derived from
00016  *   this software without specific prior written permission.
00017  *
00018  * This file is part of the StructureColoring ROS package.
00019  *
00020  * The StructureColoring ROS package is free software:
00021  * you can redistribute it and/or modify it under the terms of the
00022  * GNU Lesser General Public License as published by the Free
00023  * Software Foundation, either version 3 of the License, or
00024  * (at your option) any later version.
00025  *
00026  * The StructureColoring ROS package is distributed in the hope that it will be useful,
00027  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00028  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00029  * GNU Lesser General Public License for more details.
00030  *
00031  * You should have received a copy of the GNU Lesser General Public License
00032  * along with The StructureColoring ROS package.
00033  * If not, see <http://www.gnu.org/licenses/>.
00034  */
00035 
00036 #include <structureColoring/StrColParams.h>
00037 #include <math.h>
00038 #include <stdio.h>
00039 
00040 StrColParams::StrColParams() {
00041         init();
00042 }
00043 
00044 StrColParams::~StrColParams() {
00045         // TODO Auto-generated destructor stub
00046 }
00047 
00048 void StrColParams::init(){
00049         //for detailed parameter description look at the member variable declaration
00050         mMaxSACDistanceThreshold = 0.05f;//0.05f;
00051         mMinSACDistanceThreshold = 0.02f;//0.02f;
00052         mSACOctreeFactor = 0.1f;
00053         mSACOutlierRatioThreshold = 0.6f;
00054 //      mGridCellSize = 0.02f;//0.02 for kinect
00055         mAngleEps = M_PI / 10.f;//depends on mPhi_resolution
00056         mAngleEpsOnMinOctreeRes = mAngleEps;
00057         mMinPointsInCC = 200;
00058         mMinNodesInCC = 3;
00059         mTexelSizeFactor = 2.f;
00060         mDilateIterations = 0;
00061         mPhi_resolution = 25;
00062         mRho_max = 20.0f;
00063         mMaxHTDistanceThreshold = 0.2f; // 0.2
00064         mHTOctreeBinSizeFactor = 2.f; // 2.f
00065         mHTDistanceDeviationFactor = 1.f;
00066         mMinOctreeResolution = 0.005f;//0.005 for ABW//0.01 for kinect
00067         mSqDistFactor = 0.002f;
00068         mMinPointsForNormal = 15;
00069         mCurvThreshold = 1.f / 10.f;//1.f / 12.f;
00070         mCurv2Threshold = 0.2f;
00071         mPrincipalVarFactor = 0.f;//0.5f;
00072         mMinOctreeNodes = mMinNodesInCC;
00073         mMinNodesInCylinder = 20;
00074         mTriesOnEachDepth = 25;
00075         mPostProcessing = 3;//7?
00076         mMergePlanesSimilarityFactor = 1.f;
00077         mNodeToBBDistance = 0.2f;
00078         mDebugSteps = -1;
00079         mConnectionNeighbors = 2;
00080         mNodeSegmentedRatio = 1.f; // should be smaller but near 1.f
00081         mNormalDistanceWeight = 0.1f;
00082         mMinRadiusFactor = 0.5f;
00083         mMaxRadiusFactor = 10.f;
00084         mMinCylinderRadius = 0.025f;
00085         mMaxCylinderRadius = 1.0f;
00086         mCylinderBins = 30;
00087         mCylinderPairNeighbors = 2;
00088         mMidPointBinSizeFactor = 0.25f;
00089         mRadiusDevFactor = 1.5f;
00090         mOccupiedRatio = 0.2f;
00091         mCylinderHeightDev = 0.2f;
00092 
00093         mPclSACmaxIter = 10000;
00094         mOnlyDepth = 0;
00095         mVerbose = false;
00096         mPGM = false;
00097         mKinect = false;
00098         mLaser = false;
00099         mABW = false;
00100         mPerceptron = false;
00101         mLoadPCD = false;
00102         mPCDnoRGB = false;
00103         mTextures = false;
00104         mCylinder = false;
00105         mPclSAC = false;
00106         mNoRansacStep = false;
00107         mWriteRawPic = false;
00108         mRawPicFilename = "rawPic";
00109         mLaserTopic = "";
00110         mRawPicCounter = 0;
00111         mRuntimeFilename = "elapsed.time";
00112 }
00113 
00114 void StrColParams::parseParamFile(std::string filename)
00115 {
00116         FILE* file = fopen(filename.c_str(), "r");
00117         if (file == NULL) {
00118                 printf("cannot open paramfile, using defaults\n");
00119                 return;
00120         }
00121         if (!fscanf(file, "%f", &mMaxHTDistanceThreshold)) {
00122                 printf("could not read param mMaxHTDistanceThreshold\n paramfile has wrong format, using defaults\n");
00123                 fclose(file);
00124                 return;
00125         }
00126         if (!fscanf(file, "%f", &mHTOctreeBinSizeFactor)) {
00127                 printf("could not read param mHTOctreeBinSizeFactor\n paramfile has wrong format, using defaults\n");
00128                 fclose(file);
00129                 return;
00130         }
00131         if (!fscanf(file, "%f", &mHTDistanceDeviationFactor)) {
00132                 printf("could not read param mHTDistanceDeviationFactor\n paramfile has wrong format, using defaults\n");
00133                 fclose(file);
00134                 return;
00135         }
00136         if (!fscanf(file, "%f", &mMaxSACDistanceThreshold)) {
00137                 printf("could not read param mMaxSACDistanceThreshold\n paramfile has wrong format, using defaults\n");
00138                 fclose(file);
00139                 return;
00140         }
00141         if (!fscanf(file, "%f", &mMinSACDistanceThreshold)) {
00142                 printf("could not read param mMinSACDistanceThreshold\n paramfile has wrong format, using defaults\n");
00143                 fclose(file);
00144                 return;
00145         }
00146         if (!fscanf(file, "%f", &mSACOctreeFactor)) {
00147                 printf("could not read param mSACOctreeFactor\n paramfile has wrong format, using defaults\n");
00148                 fclose(file);
00149                 return;
00150         }
00151         if (!fscanf(file, "%f", &mSACOutlierRatioThreshold)) {
00152                 printf("could not read param mSACOutlierRatioThreshold\n paramfile has wrong format, using defaults\n");
00153                 fclose(file);
00154                 return;
00155         }
00156         if (!fscanf(file, "%f", &mMinOctreeResolution)) {
00157                 printf("could not read param mMinOctreeResolution\n paramfile has wrong format, using defaults\n");
00158                 fclose(file);
00159                 return;
00160         }
00161         if (!fscanf(file, "%f", &mSqDistFactor)) {
00162                 printf("could not read param mSqDistFactor\n paramfile has wrong format, using defaults\n");
00163                 fclose(file);
00164                 return;
00165         }
00166         if (!fscanf(file, "%d", &mPhi_resolution)) {
00167                 printf("could not read param mPhi_resolution\n paramfile has wrong format, using defaults\n");
00168                 fclose(file);
00169                 return;
00170         }
00171         if (!fscanf(file, "%d", &mConnectionNeighbors)) {
00172                 printf("could not read param mConnectionNeighbors\n paramfile has wrong format, using defaults\n");
00173                 fclose(file);
00174                 return;
00175         }
00176         if (!fscanf(file, "%f", &mAngleEps)) {
00177                 printf("could not read param mAngleEps\n paramfile has wrong format, using defaults\n");
00178                 fclose(file);
00179                 return;
00180         }
00181         if (!fscanf(file, "%f", &mRadiusDevFactor)) {
00182                 printf("could not read param mRadiusDevFactor\n paramfile has wrong format, using defaults\n");
00183                 fclose(file);
00184                 return;
00185         }
00186         if (!fscanf(file, "%d", &mTriesOnEachDepth)) {
00187                 printf("could not read param mTriesOnEachDepth\n paramfile has wrong format, using defaults\n");
00188                 fclose(file);
00189                 return;
00190         }
00191         if (!fscanf(file, "%f", &mOccupiedRatio)) {
00192                 printf("could not read param mOccupiedRatio\n paramfile has wrong format, using defaults\n");
00193                 fclose(file);
00194                 return;
00195         }
00196         if (!fscanf(file, "%f", &mNormalDistanceWeight)) {
00197                 printf("could not read param mNormalDistanceWeight\n paramfile has wrong format, using defaults\n");
00198                 fclose(file);
00199                 return;
00200         }
00201         fclose(file);
00202 }


structure_coloring_fkie
Author(s): Bastian Gaspers
autogenerated on Sun Jan 5 2014 11:38:09