コード例 #1
0
OneBitImageView* to_logical(const T &src)
{
    OneBitImageData* data = new OneBitImageData(src.size(), src.origin());
    OneBitImageView* view = new OneBitImageView(*data);
    transform(src.vec_begin(),
              src.vec_end(),
              view->vec_begin(),
              to_logical_core<typename T::value_type>());
    return view;
}
コード例 #2
0
OneBitImageView* add_edge(const T &src, unsigned int interval)
{
    OneBitImageData* data = new OneBitImageData(src.size(), src.origin());
    OneBitImageView* view = new OneBitImageView(*data);
    copy(src.vec_begin(),
              src.vec_end(),
              view->vec_begin());

    for (unsigned int y=interval; y<view->nrows()-interval; y++) {
        view->set(Point(0, y), 1);
        view->set(Point(view->ncols()-1, y), 1);
    }
    for (unsigned int x=interval; x<view->ncols()-interval; x++) {
        view->set(Point(x, 0), 1);
        view->set(Point(0, view->nrows()-1), 1);
    }
    return view;
}