Example #1
0
  /*
   * read the classifier from the given ioHandler
   */
  bool svm::read(ioHandler& handler,const bool complete) {
    bool b=true;
    if (complete) {
      b=handler.readBegin();
    }
    b = b && supervisedInstanceClassifier::read(handler,false);
    if (b) {
      b=b && lti::read(handler, "nClasses",nClasses);
      b=b && lti::read(handler, "alpha",alpha);
      delete trainData;
      dmatrix* t=new dmatrix();
      b=b && lti::read(handler, "vectors",*t);
      trainData=t;
      b=b && lti::read(handler, "idMap",idMap);
      b=b && lti::read(handler, "rIdMap",rIdMap);
      b=b && lti::read(handler, "srcIds",srcIds);
      b=b && lti::read(handler, "bias", bias);
      int n;
      b=b && lti::read(handler, "nKernels", n);
      //kernels.
      b=b && handler.readBegin();
      b=b && handler.trySymbol("kernels");
      className cn;
      std::string kname;
      kernels.resize(n);
      // always read the complete kernel vector, so we have the setup
      // ready to go without the need for any subsequent
      // initializations
      for (int i=0; i<n; i++) {
        b=b && lti::read(handler, "name", kname);
        if (kname != "unknown") {
          kernels[i]=getParameters().createKernel(kname);
          b=b && kernels[i]->read(handler);
        } else {
          kernels[i]=0;
        }
      }
      b=b && handler.readEnd();
      b=b && lti::read(handler, "offset", offset);
      b=b && lti::read(handler, "scale", scale);
      rebuildTargets();
      defineOutputTemplate();
    }
    if (complete) {
      b=b && handler.readEnd();
    }

    return b;
  }
  bool regionMerge::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"threshold",threshold);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && functor::parameters::read(handler,false);
# else
    bool (functor::parameters::* p_readMS)(ioHandler&,const bool) =
      functor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool histogramRGBL::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"smooth",smooth);
      lti::read(handler,"normalize",normalize);
      lti::read(handler,"cells",cells);
      lti::read(handler,"considerAllData",considerAllData);
      lti::read(handler,"ignoreValue",ignoreValue);
      lti::read(handler,"kernel",kernel);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && globalFeatureExtractor::parameters::read(handler,false);
# else
    bool (globalFeatureExtractor::parameters::* p_readMS)(ioHandler&,const bool) =
      globalFeatureExtractor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool fastViewer::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      lti::read(handler, "topleft" ,topleft);
      lti::read(handler, "noBorder" ,noBorder);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && viewerBase::parameters::read(handler,false);
# else
    bool (viewerBase::parameters::* p_readMS)(ioHandler&,const bool) =
      viewerBase::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool huMoments::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"scaling",scaling);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && globalFeatureExtractor::parameters::read(handler,false);
# else
    bool (globalFeatureExtractor::parameters::* p_readMS)(ioHandler&,const bool) =
      globalFeatureExtractor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool kNearestNeighFilter::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

	lti::read(handler,"kernelSize",kernelSize);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && filter::parameters::read(handler,false);
# else
    bool (filter::parameters::* p_readMS)(ioHandler&,const bool) =
      filter::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool sigmoidKernel::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      b=b && lti::read(handler, "kappa", kappa);
      b=b && lti::read(handler, "theta", theta);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && kernelFunctor<double>::parameters::read(handler,false);
# else
    bool (kernelFunctor<double>::parameters::* p_readMS)(ioHandler&,const bool) =
      kernelFunctor<double>::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
Example #8
0
  // read method
  bool MLP::read(ioHandler& handler,const bool complete) {
    bool b(true);

    if (complete) {
      b = handler.readBegin();
    }

    // read the standard data (output and parameters)
    supervisedInstanceClassifier::read(handler,false);

    if (b) {
      if (lti::read(handler,"inputs",inputs) && 
          lti::read(handler,"outputs",outputs)) {
        if (lti::read(handler,"weights",weights)) {
          b = initWeights(true); // initialize internal state keeping
          // the weights...
        } else {
          initWeights(false,-1,1);
          b = false;
        }
      } else {
        b = false;
      }
    }

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool binomialDistribution::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"sampleSize",sampleSize);
      lti::read(handler,"events",events);
      lti::read(handler,"confidence",confidence);
      lti::read(handler,"accuracy",accuracy);
      lti::read(handler,"baseProbability",baseProbability);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && discreteRandomDistribution::parameters::read(handler,false);
# else
    bool (discreteRandomDistribution::parameters::* p_readMS)(ioHandler&,const bool) =
      discreteRandomDistribution::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool medianCut::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"preQuant",preQuant);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && colorQuantization::parameters::read(handler,false);
# else
    bool (colorQuantization::parameters::* p_readMS)(ioHandler&,const bool) =
      colorQuantization::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool labelAdjacencyMap::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"minColors",minColors);
      lti::read(handler,"thePalette",thePalette);
      lti::read(handler,"neighborhood",neighborhood);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && functor::parameters::read(handler,false);
# else
    bool (functor::parameters::* p_readMS)(ioHandler&,const bool) =
      functor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
Example #12
0
  bool SOFM2D::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"area",area);
      lti::read(handler,"sizeX",sizeX);
      lti::read(handler,"sizeY",sizeY);
      lti::read(handler,"calculateSize",calculateSize);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && SOFM::parameters::read(handler,false);
# else
    bool (SOFM::parameters::* p_readMS)(ioHandler&,const bool) =
      SOFM::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool homography8DofEstimator::parameters::readMS(ioHandler& handler,
                                                   const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && homographyEstimatorBase::parameters::read(handler,false);
# else
    bool (homographyEstimatorBase::parameters::* p_readMS)
      (ioHandler&,const bool)=
      homographyEstimatorBase::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
    bool hessianFunctor::parameters::readMS(ioHandler& handler,
                                            const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      std::string str;
            
      lti::read(handler,"kernelType",str);
      if (str == "Ando") {
        kernelType = Ando;
      } else if (str == "OGD") {
        kernelType = OGD2;
      } else if (str == "Classic") {
        kernelType = Classic;
      } else if (str == "Sobel") {        
        kernelType = Sobel;
      } else if (str == "Prewitt") {        
        kernelType = Prewitt;
      } else if (str == "Robinson") {        
        kernelType = Robinson;
      } else if (str == "Kirsch") {        
        kernelType = Kirsch;
      } else if (str == "Harris") {        
        kernelType = Harris;
      } else if (str == "Hessian") {        
        kernelType = Hessian;
      } else {
        kernelType = Hessian;
        handler.setStatusString("Unknown kernel type");
        b = false;
      }

      lti::read(handler,"kernelSize",kernelSize);
      lti::read(handler,"kernelVariance",kernelVariance);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && transform::parameters::read(handler,false);
# else
    bool (transform::parameters::* p_readMS)(ioHandler&,const bool) =
      transform::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
Example #15
0
  bool MLP::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      std::string str;
      lti::read(handler,"trainingMode",str);
      if (str == "ConjugateGradients") {
        trainingMode = ConjugateGradients;
      } else {
        trainingMode = SteepestDescent;
      }

      lti::read(handler,"batchMode",batchMode);
      lti::read(handler,"momentum",momentum);
      lti::read(handler,"hiddenUnits",hiddenUnits);
      lti::read(handler,"learnrate",learnrate);
      lti::read(handler,"maxNumberOfEpochs",maxNumberOfEpochs);
      lti::read(handler,"stopError",stopError);

      unsigned int i;

      for (i=0;i<activationFunctions.size();++i) {
        delete activationFunctions[i];
      }
      
      const int layers = hiddenUnits.size()+1;
      activationFunctions.resize(layers);
      std::string className;
      for (i=0;i<activationFunctions.size();++i) {
        lti::read(handler,"activationFunctorType",className);
        activationFunctions[i] = objFactory.newInstance(className);
        lti::read(handler,"functor",*activationFunctions[i]);
      }

    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && supervisedInstanceClassifier::parameters::read(handler,false);
# else
    bool (supervisedInstanceClassifier::parameters::* p_readMS)(ioHandler&,const bool) =
      supervisedInstanceClassifier::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool distanceTransform::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      std::string str;
      lti::read(handler,"distance",str);
      if (str == "EightNeighborhood") {
         distance = EightNeighborhood;
      } else if (str == "FourNeighborhood") {
        distance = FourNeighborhood;
      } else if (str == "EuclideanSqr") {
        distance = EuclideanSqr;
      } else if (str == "Euclidean") {
        distance = Euclidean;
      } else if (str == "EightSED") {
        distance = EightSED;
      } else if (str == "EightSEDSqr") {
        distance = EightSEDSqr;
      } else if (str == "FourSED") {
        distance = FourSED;
      } else if (str == "FourSEDSqr") {
        distance = FourSEDSqr;
      } else {
        distance = EightNeighborhood;
      }

    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && morphology::parameters::read(handler,false);
# else
    bool (morphology::parameters::* p_readMS)(ioHandler&,const bool) =
      morphology::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
    bool dunnIndex::parameters::readMS(ioHandler& handler,
                                       const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      std::string str1,str2;
      lti::read(handler,"diameterMeasure",str1);
      lti::read(handler,"distanceMeasure",str2);
      if (str1.find("tand") != std::string::npos) {
        diameterMeasure = Standard;
      } else if (str1.find("verag") != std::string::npos) {
        diameterMeasure = Average;
      } else if (str1.find("entr")!= std::string::npos) {
        diameterMeasure = Centroid;
      }

      if (str2.find("inim") != std::string::npos) {
        distanceMeasure = Minimum;
      } else if (str2.find("axim") != std::string::npos) {
        distanceMeasure = Maximum;
      } else if (str2.find("ean") != std::string::npos) {
        distanceMeasure = Mean;
      } else if (str2.find("nterp") != std::string::npos) {
        distanceMeasure = Interpoint;
      } else if (str2.find("entroid") != std::string::npos) {
        distanceMeasure = Centroids;
      }
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to 
    // compile...
    b = b && clusteringValidity::parameters::read(handler,false);
# else
    bool (clusteringValidity::parameters::* p_readMS)(ioHandler&,const bool) = 
      clusteringValidity::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
Example #18
0
  bool camera::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      float dummy;
      lti::write(handler,"autoWhiteBalance",autoWhiteBalance);
      lti::write(handler,"autoGain",autoGain);
      lti::write(handler,"gain",gain);
      lti::write(handler,"redGain",redGain);
      lti::write(handler,"blueGain",blueGain);
      lti::write(handler,"minGain",dummy);
      lti::write(handler,"maxGain",dummy);
      lti::write(handler,"minRBGain",dummy);
      lti::write(handler,"maxRBGain",dummy);
      lti::write(handler,"autoShutter",autoShutter);
      lti::write(handler,"shutterSpeed",shutterSpeed);
      lti::write(handler,"minShutterSpeed",dummy);
      lti::write(handler,"maxShutterSpeed",dummy);
      lti::write(handler,"autoFocus",autoFocus);
      lti::write(handler,"focus",focus);
      lti::write(handler,"minFocus",dummy);
      lti::write(handler,"maxFocus",dummy);
      lti::write(handler,"zoom",zoom);
      lti::write(handler,"maxZoom",dummy);   
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && functor::parameters::read(handler,false);
# else
    bool (functor::parameters::* p_readMS)(ioHandler&,const bool) =
      functor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool brightRGB::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    std::string str;
    b = b && lti::read(handler,"type",str);

    if (str == "Minimum") {
      type = Minimum;
    } else if (str == "Maximum") {
      type = Maximum;
    } else if (str == "Average") {
      type = Average;
    } else if (str == "Median") {
      type = Median;
    } else {
      type = Average;
    }

    b = b && lti::read(handler,"transparent",transparent);
    b = b && lti::read(handler,"transColor",transColor);

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && globalFeatureExtractor::parameters::read(handler,false);
# else
    bool (globalFeatureExtractor::parameters::* p_readMS)
      (ioHandler&,const bool) =
      globalFeatureExtractor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool fuzzyCMeans::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"fuzzifier",fuzzifier);
//      lti::read(handler,"norm",norm);
      lti::read(handler,"epsilon",epsilon);
      lti::read(handler,"maxIterations",maxIterations);
      lti::read(handler,"nbOfClusters",nbOfClusters);
      std::string str;
      lti::read(handler,"norm",str);

      if (str == "L1distance") {
        norm = L1;
      } else if (str == "L2distance") {
        norm = L2;
      } else {
        norm = L2;
      }
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && centroidClustering::parameters::read(handler,false);
# else
    bool (centroidClustering::parameters::* p_readMS)(ioHandler&,const bool) =
      centroidClustering::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
Example #21
0
  bool panTiltUnit::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {  
      std::string str;
      float dummy;
      lti::read(handler,"angleFormat",str);
      if (str == "Degrees")
	angleFormat = Degrees;
      else
	angleFormat = Radiant;  //default
      lti::read(handler,"pan", pan);
      lti::read(handler,"tilt", tilt);
      lti::read(handler,"relativeMovement", relativeMovement);
      lti::read(handler,"minPan", dummy);
      lti::read(handler,"maxPan", dummy);
      lti::read(handler,"minTilt", dummy);
      lti::read(handler,"maxTilt", dummy);
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && functor::parameters::read(handler,false);
# else
    bool (functor::parameters::* p_readMS)(ioHandler&,const bool) =
      functor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  /*
   * read the parameters from the given ioHandler
   * @param handler the ioHandler to be used
   * @param complete if true (the default) the enclosing begin/end will
   *        be also read, otherwise only the data block will be read.
   * @return true if read was succeful
   */
  bool cwagmSegmentationEvaluation::parameters::read(ioHandler& handler,
                                                     const bool& complete) {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      lti::read(handler,"minValues",minValues);
      lti::read(handler,"maxValues",maxValues);
    }

    b = b && segmentationEvaluation::parameters::read(handler,false);

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool centroidClustering::read(ioHandler& handler,const bool complete) {
    bool b(true);

    if (complete) {
      b = handler.readBegin();
    }


    // read the standard data (output and parameters)
    b = b && clustering::read(handler,false);

    b = b && lti::read(handler,"centroids",centroids);

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;

  }
Example #24
0
  bool SOFM::read(ioHandler& handler,const bool complete) {
    bool b(true);

    if (complete) {
      b = handler.readBegin();
    }

    // read the standard data (output and parameters)
    unsupervisedClassifier::read(handler,false);

    if (b) {
      lti::read(handler,"grid",grid);
    }

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  bool shClassifier::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    _lti_debug("b="<<b<<",");

    if (b) {
      b=b && lti::read(handler, "numberOfBins",numberOfBins);
    _lti_debug("b="<<b<<",");
      b=b && lti::read(handler, "binVector",binVector);
    _lti_debug("b="<<b<<",");
      b=b && lti::read(handler, "minimum",minimum);
    _lti_debug("b="<<b<<",");
      b=b && lti::read(handler, "maximum",maximum);
    _lti_debug("b="<<b<<",");
      b=b && lti::read(handler, "autoBounds", autoBounds);
    }
    _lti_debug("b="<<b<<",");

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && supervisedInstanceClassifier::parameters::read(handler,false);
# else
    bool (supervisedInstanceClassifier::parameters::* p_readMS)(ioHandler&,const bool) =
      supervisedInstanceClassifier::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }
    _lti_debug("b="<<b<<",");

    return b;
  }
    bool ioLTI::parameters::readMS(ioHandler& handler,
                                   const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && ioFunctor::parameters::read(handler,false);
# else
    bool (ioFunctor::parameters::* p_readMS)(ioHandler&,const bool) =
      ioFunctor::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    std::string tmp;
    lti::read(handler, "compression", tmp);
    if (tmp == "None") {
      compression=None;
    } else if (tmp == "RunLength") {
      compression=RunLength;
    } else if (tmp == "Flate") {
      compression=Flate;
    } else {
      // ERROR
      compression=None;
    }

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
Example #27
0
  bool SOFM2D::read(ioHandler& handler,const bool complete) {
    bool b(true);

    if (complete) {
      b = handler.readBegin();
    }

    // read the standard data (output and parameters)
    SOFM::read(handler,false);

    if (b) {
      lti::read(handler,"sizeX",sizeX);
      lti::read(handler,"sizeY",sizeY);
    }

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
  /*
   * read the classifier from the given ioHandler
   */
  bool shClassifier::read(ioHandler& handler,const bool complete) {
    bool b=true;
    if (complete) {
      b=handler.readBegin();
    }
    b = b && supervisedInstanceClassifier::read(handler,false);
    if (b) {
      b=b && lti::read(handler, "nClasses",nClasses);
      b=b && lti::read(handler, "idMap",idMap);
      b=b && lti::read(handler, "rIdMap",rIdMap);

      _lti_debug("B1 = " << b << " in " << this << "\n");

      models.resize(nClasses);

      if (getParameters().binVector.size() > 0) {
        const ivector& bvect=getParameters().binVector;
        for (int i=0; i<nClasses; i++) {
          models[i]=new sparseHistogram(bvect);
          b=b && models[i]->read(handler);
        }
        _lti_debug("B2 = " << b << "\n");
      } else {
        int bins=getParameters().numberOfBins;
        for (int i=0; i<nClasses; i++) {
          models[i]=new sparseHistogram(bins,0);
          b=b && models[i]->read(handler);
        }
        _lti_debug("B3 = " << b << "\n");
      }
      //b=b && handler.readEnd();
    }
    if (complete) {
      b=b && handler.readEnd();
    }

    return b;
  }
  bool harrisCorners::parameters::readMS(ioHandler& handler,
                                          const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {

      lti::read(handler,"variance",variance);
      lti::read(handler,"kernelSize",kernelSize);
      lti::read(handler,"maximumCorners",maximumCorners);
      lti::read(handler,"scale",scale);
      lti::read(handler,"localMaximaParameters",localMaximaParameters);
      lti::read(handler,"gradientFunctorParameters",
                 gradientFunctorParameters);

    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to
    // compile...
    b = b && cornerDetector::parameters::read(handler,false);
# else
    bool (cornerDetector::parameters::* p_readMS)(ioHandler&,const bool) =
      cornerDetector::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }
Example #30
0
    bool sffs::parameters::readMS(ioHandler& handler,
                                  const bool complete)
# endif
  {
    bool b = true;
    if (complete) {
      b = handler.readBegin();
    }

    if (b) {
      usedCostFunction->read(handler,false);
//       std::string str;
//       lti::read(handler,"classifier",str);
//       const supervisedInstanceClassifier* types[] = { new rbf, new lvq, 
//                                                       new svm, new shClassifier, new manualCrispDecisionTree, 0 };
//       objectFactory<supervisedInstanceClassifier> objFac(types);
//       classifier = objFac.newInstance(str);

    }

# ifndef _LTI_MSC_6
    // This is the standard C++ code, which MS Visual C++ 6 is not able to 
    // compile...
    b = b && featureSelector::parameters::read(handler,false);
# else
    bool (featureSelector::parameters::* p_readMS)(ioHandler&,const bool) = 
      featureSelector::parameters::readMS;
    b = b && (this->*p_readMS)(handler,false);
# endif

    if (complete) {
      b = b && handler.readEnd();
    }

    return b;
  }