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


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

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


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

示例1: paint_vertex

  void paint_vertex(VertexDescriptorType target, VertexDescriptorType source, TGraph& g) const
  {
    itk::Index<2> target_index;
    target_index[0] = target[0];
    target_index[1] = target[1];

    itk::Index<2> source_index;
    source_index[0] = source[0];
    source_index[1] = source[1];

    assert(image->GetLargestPossibleRegion().IsInside(source_index));
    assert(image->GetLargestPossibleRegion().IsInside(target_index));

    Image->SetPixel(target_index, Image->GetPixel(source_index));
  }
开发者ID:SXYJerry,项目名称:PatchBasedInpainting,代码行数:15,代码来源:FeatureVectorInpaintingVisitor.hpp

示例2: PaintPatch

  void PaintPatch(TVertexDescriptor target, TVertexDescriptor source) const
  {
    TVertexDescriptor target_patch_corner;
    target_patch_corner[0] = target[0] - PatchHalfWidth;
    target_patch_corner[1] = target[1] - PatchHalfWidth;

    TVertexDescriptor source_patch_corner;
    source_patch_corner[0] = source[0] - PatchHalfWidth;
    source_patch_corner[1] = source[1] - PatchHalfWidth;

    TVertexDescriptor target_node;
    TVertexDescriptor source_node;
    for(std::size_t i = 0; i < PatchHalfWidth * 2 + 1; ++i)
    {
      for(std::size_t j = 0; j < PatchHalfWidth * 2 + 1; ++j)
      {
        target_node[0] = target_patch_corner[0] + i;
        target_node[1] = target_patch_corner[1] + j;

        source_node[0] = source_patch_corner[0] + i;
        source_node[1] = source_patch_corner[1] + j;

        // Only paint the pixel if it is currently a hole
        if( MaskImage->IsHole(ITKHelpers::CreateIndex(target_node)) )
        {
          //std::cout << "Copying pixel " << source_node << " to pixel " << target_node << std::endl;
          itk::Index<2> target_index = ITKHelpers::CreateIndex(target);

          itk::Index<2> source_index = ITKHelpers::CreateIndex(source);

          assert(Image->GetLargestPossibleRegion().IsInside(source_index));
          assert(Image->GetLargestPossibleRegion().IsInside(target_index));

          Image->SetPixel(target_index, Image->GetPixel(source_index));
        }

      }
    }
  };
开发者ID:nocnokneo,项目名称:PatchBasedInpainting,代码行数:39,代码来源:InpaintPatchVisitor.hpp


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