Exemplo n.º 1
0
void CControl::ReadParam()
{
  ifstream n_file("TaxiTractor.ini");
  nControlOptions.nSteps=(int)GetParam(n_file);
  nControlOptions.nWidth=(int)GetParam(n_file);
  nControlOptions.nHeight=(int)GetParam(n_file);
  nControlOptions.nAngelCout=(int)GetParam(n_file);
  nControlOptions.nAngleThhold=GetParam(n_file);
  int n_NumScale=(int)GetParam(n_file);
  for(int i=0;i<n_NumScale;i++)
    {
      float n_scale=GetParam(n_file);
      nControlOptions.nScale.push_back(n_scale);
    }
  nControlOptions.nInterval=(int)GetParam(n_file);
  nControlOptions.nRansacThreshold=GetParam(n_file);
  nControlOptions.nRansacMininlier=GetParam(n_file);

  // //for evaluation
  nControlOptions.mDensityWeight=GetParam(n_file);
  nControlOptions.mLengthWeight=GetParam(n_file);
  nControlOptions.mEvaluateThreshold=GetParam(n_file);
  if(nIfDebug)
    {
      cout<<"read params  "<<nControlOptions.nSteps<<' '<<nControlOptions.nWidth<<' '<<nControlOptions.nHeight<<' '<<nControlOptions.nAngleThhold<<endl;
    }
}
/*----------------------------------------------------------------------*/
void AzSvDataS::mergeData(const AzSmat *m_x,
                         const AzSvFeatInfo *feat,
                         const char *fn_template,
                         const char *str,
                         bool doSparse,
                         int digits,
                         const char *out_x_fn,
                         const char *out_n_fn,
                         int num,
                         const char *names[])
{
  const char *eyec = "AzSvDataS::mergeData";

  int data_num = m_x->colNum();
  int f_num = m_x->rowNum();
  if (feat->featNum() != f_num) {
    throw new AzException(eyec, "Conflict btw m_x and featInfo");
  }
  AzFile n_file(out_n_fn);
  n_file.open("wb");
  int fx;
  for (fx = 0; fx < feat->featNum(); ++fx) {
    AzBytArr s; feat->desc(fx, &s); s.nl();
    s.writeText(&n_file);
  }

  AzSmat m;
  m_x->transpose(&m);
  m.resize(data_num, f_num+num);
  AzStrPool sp_names;
  for (fx = 0; fx < num; ++fx) {
    AzBytArr s_fn(fn_template);
    s_fn.replace("*", names[fx]);

    AzDvect v;
    AzSvDataS::readVector(s_fn.c_str(), &v);
    if (v.rowNum() != m.rowNum()) {
      throw new AzException(AzInputError, eyec, "conflict in #data:", s_fn.c_str());
    }
    m.col_u(f_num+fx)->set(&v);

    AzBytArr s_nm;
    if (AzTools::isSpecified(str)) s_nm.c(str);
    s_nm.c(names[fx]); s_nm.nl();
    s_nm.writeText(&n_file);
  }
  n_file.close(true);

  AzSmat m1;
  m.transpose(&m1);
  m1.writeText(out_x_fn, digits, doSparse);
}