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


C++ TImage::domain方法代码示例

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


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

示例1: draw

void draw( const TImage aImg, const double& aMaxValue, std::string aBasename) 
{
  typedef typename TImage::Domain::ConstIterator ConstIteratorOnPoints; 
  typedef typename TImage::Domain::Point Point; 
  HueShadeColorMap<double, 2> colorMap(0,aMaxValue);

  Board2D b; 
  b.setUnit ( LibBoard::Board::UCentimeter );
 
  for (ConstIteratorOnPoints it = aImg.domain().begin(), itEnd = aImg.domain().end();
       it != itEnd; ++it)
    {
      Point p = *it; 
      b << CustomStyle( p.className(), new CustomFillColor( colorMap( aImg(p) ) ) );
      b << p;
    }

  {
    std::stringstream s; 
    s << aBasename << ".eps"; 
    b.saveEPS(s.str().c_str());
  }
  #ifdef WITH_CAIRO
  {
    std::stringstream s; 
    s << aBasename << ".png"; 
    b.saveCairo(s.str().c_str(), Board2D::CairoPNG);
  }
  #endif
} 
开发者ID:Victor-Ostromoukhov,项目名称:DGtal,代码行数:30,代码来源:exampleFMM2D.cpp

示例2: n

void 
computerBasicNormalsFromHeightField(const TImage &anHeightMap, TImageVector &vectorField)
{
  for(typename TImage::Domain::ConstIterator it = anHeightMap.domain().begin(); 
      it != anHeightMap.domain().end(); it++){
    if(anHeightMap.domain().isInside(*it+Z2i::Point::diagonal(1))&&
       anHeightMap.domain().isInside(*it-Z2i::Point::diagonal(1))){
      double dx = (anHeightMap(*it-Z2i::Point(1,0))-anHeightMap(*it+Z2i::Point(1,0)))/2.0;
      double dy = (anHeightMap(*it-Z2i::Point(0,1))-anHeightMap(*it+Z2i::Point(0,1)))/2.0;
      Z3i::RealPoint n (dx, dy, 1);
      n /= n.norm();
      vectorField.setValue(*it,n);
    }
  }
}
开发者ID:jlevallois,项目名称:DGtalTools,代码行数:15,代码来源:heightfield2shading.cpp

示例3: scaledImage

static QImage 
getImage(const TImage &anImage, double gridSize=1.0 ){
  typedef ConstImageAdapter<TImage, typename TImage::Domain, 
                            functors::BasicDomainSubSampler<typename TImage::Domain, int, double>,  
                            typename TImage::Value,
                            functors::Identity > ConstImageAdapterForSubSampling;
  
  std::vector<double> scales;
  scales.push_back(gridSize);
  scales.push_back(gridSize);
  
  functors::BasicDomainSubSampler<typename TImage::Domain, int, double> subSampler (anImage.domain(), scales, Z2i::Point(0,0)); 
  typename TImage::Domain newDomain = subSampler.getSubSampledDomain();
  functors::Identity id;
  ConstImageAdapterForSubSampling  scaledImage (anImage, newDomain, subSampler, id ); 
  
  unsigned int height = scaledImage.domain().upperBound()[1]+1;
  unsigned int width = scaledImage.domain().upperBound()[0]+1;
  uchar * data = new uchar [height*width*4];
  for(unsigned int i=0; i<height; i++){
    for(unsigned int j=0; j<width; j++){
      data[(j+width*i)*4]=scaledImage(Z2i::Point(j,i));
      data[(j+width*i)*4+1]=scaledImage(Z2i::Point(j,i));
      data[(j+width*i)*4+2]=scaledImage(Z2i::Point(j,i));
      data[(j+width*i)*4+3]=scaledImage(Z2i::Point(j,i));
    }
  }
   QImage result(  data, width,  height, QImage::Format_RGB32 );
   return result;
}
开发者ID:fabienbaldacci,项目名称:DGtalTools,代码行数:30,代码来源:sliceViewer.cpp


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