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


C++ channel::lastColumn方法代码示例

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


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

示例1: min

  void distanceTransform::iteration4back(channel& chnl) const {
    int x,y,z;

    const int rowm1 = chnl.lastRow();
    const int colm1 = chnl.lastColumn();

    static const int deltax[6] = {1,0,-1, 0, 1,0};
    static const int deltay[6] = {0,1, 0,-1, 0,1};

    float minimum;

    // bottom-right
    if (chnl.at(rowm1,colm1) > 0) {
      chnl.at(rowm1,colm1) = 1.0f+min(chnl.at(rowm1,colm1-1),
                                      chnl.at(rowm1-1,colm1));
    }

    // bottom
    y = rowm1;
    for (x=colm1-1;x>0;--x) {
      if (chnl.at(y,x) > 0) {
        // valid pixel, let's check for the distance value
        minimum = chnl.at(y+deltay[2],x+deltax[2]);

        for (z=3;z<5;++z) {
          minimum = min(minimum,chnl.at(y+deltay[z],x+deltax[z]));
        }

        chnl.at(y,x) = minimum+1.0f;
      }
    }

    // bottom-left
    if (chnl.at(rowm1,0) > 0) {
      chnl.at(rowm1,0) = 1.0f+min(chnl.at(rowm1,1),
                                  chnl.at(rowm1-1,0));
    }

    // inner of the image only...
    for (y=rowm1-1;y>0;--y) {
      x = colm1;
      // right border
      if (chnl.at(y,x) > 0) {
        minimum = chnl.at(y+deltay[1],x+deltax[1]);

        for (z=2;z<4;++z) {
          minimum = min(minimum,chnl.at(y+deltay[z],x+deltax[z]));
        }

        chnl.at(y,x) = minimum+1.0f;
      }

      // inner of the line
      for (x=colm1-1;x>0;--x) {
        if (chnl.at(y,x) > 0) {
          // valid pixel, let's check for the distance value
          minimum = chnl.at(y+deltay[0],x+deltax[0]);

          for (z=1;z<4;++z) {
            minimum = min(minimum,chnl.at(y+deltay[z],x+deltax[z]));
          }

          chnl.at(y,x) = minimum+1.0f;
        }
      }

      // left border
      if (chnl.at(y,x) > 0) {
        minimum = chnl.at(y+deltay[3],x+deltax[3]);

        for (z=0;z<2;++z) {
          minimum = min(minimum,chnl.at(y+deltay[z],x+deltax[z]));
        }

        chnl.at(y,x) = minimum+1.0f;
      }
    }

    // upper-right
    if (chnl.at(0,colm1) > 0) {
      chnl.at(0,colm1) = 1.0f+min(chnl.at(0,colm1-1),
                                  chnl.at(1,colm1));
    }

    // top
    for (x=colm1-1;x>0;--x) {
      if (chnl.at(y,x) > 0) {
        // valid pixel, let's check for the distance value
        minimum = chnl.at(y+deltay[0],x+deltax[0]);

        for (z=1;z<3;++z) {
          minimum = min(minimum,chnl.at(y+deltay[z],x+deltax[z]));
        }

        chnl.at(y,x) = minimum+1.0f;
      }
    }

    // upper-left
    if (chnl.at(0,0) > 0) {
//.........这里部分代码省略.........
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:101,代码来源:ltiDistanceTransform.cpp


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