当前位置: 首页>>代码示例>>C++>>正文


C++ Tensor::IDFT方法代码示例

本文整理汇总了C++中Tensor::IDFT方法的典型用法代码示例。如果您正苦于以下问题:C++ Tensor::IDFT方法的具体用法?C++ Tensor::IDFT怎么用?C++ Tensor::IDFT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tensor的用法示例。


在下文中一共展示了Tensor::IDFT方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void)
{
  Tensor<double,1> ts("/home/guoxin/Projects/MTC/data/texture1.png");
  //ts.Display();
  Tensor<double,2> cts = ts.ToComplex();
  double time = (double)getTickCount();
  Tensor<double,2> f;
  for (int i=0; i<1000; i++)
  {
    f = cts.DFT();
    cout<<i<<endl;
  }
  f = f.IDFT();

  time = 1000*((double)getTickCount() - time)/getTickFrequency();
  cout<<"time = " <<time<<"ms"<<endl;
  Mat temp = f.GetFrame(0);
  vector<Mat> tv;
  cv::split(temp,tv);
  Tensor<double,1>(tv[0]).Display(); 
  Cube c(0,0,0,10,10,1);
  cout<<c.area()<<endl;
  Steerable sp;
  sp.buildSCFpyr(f,3,4,1,false);
  vector<Tensor<double,2> >& pyr = sp.getSpaceDomainPyr();
  cv::split(pyr[12],tv);
  Tensor<double,1>(tv[0]).Display(); 
  Tensor<double,1> ts2("/home/guoxin/Projects/MTC/data/texture2.png");
  cout<<ComputeMSE(ts,ts2)<<endl;
  ts2.Print("t2",true);

  //test LocalMean
  Mat flatker = Mat::ones(Size(16,16),CV_64F)/256;
  //verify local mean
  BufferGPU gbuf;
  Size3 subWin(16,16,1);
  auto mu1 = ts.LocalMean(flatker,subWin);
  auto mu2 = ts.LocalMeanGPU(flatker,gbuf,subWin);
  (mu1-mu2).Print();
  mu1.Print();
  auto var1 = ts.LocalVariance(mu1,flatker,subWin);
  auto var2 = ts.LocalVarianceGPU(mu2,flatker,gbuf,subWin);
  var1.Print();
  var2.Print();
  (var1-var2).Print();
//  mylib::DisplayMat(flatker);
  int TIMES=10000;
     time = (double)getTickCount();
  for (int i=0; i< TIMES; i++)
    {
  Tensor<double,1> mu=ts.LocalMean(flatker,Size3(16,16,1));
  ts.LocalVariance(mu,flatker,Size3(16,16,1));
    }
  time = 1000*((double)getTickCount() - time)/getTickFrequency();
     time /= TIMES;
 cout << "Time of CPU (averaged for " << TIMES << " runs): " << time << " milliseconds."<<endl;


time = (double)getTickCount();
for (int i=0; i< TIMES; i++)
{
Tensor<double,1> mu=ts.LocalMeanGPU(flatker,gbuf,Size3(16,16,1));
ts.LocalVarianceGPU(mu,flatker,gbuf,Size3(16,16,1));
}
time = 1000*((double)getTickCount() - time)/getTickFrequency();
 time /= TIMES;
cout << "Time of GPU (averaged for " << TIMES << " runs): " << time << " milliseconds."<<endl;



  return 0;



}
开发者ID:jgmao,项目名称:MTC,代码行数:75,代码来源:testTensor.cpp


注:本文中的Tensor::IDFT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。