本文整理汇总了C++中ImageView::getStride方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::getStride方法的具体用法?C++ ImageView::getStride怎么用?C++ ImageView::getStride使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView::getStride方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void SBTopHat::SBTopHatImpl::fillXImage(ImageView<double> im,
double x0, double dx, int izero,
double y0, double dy, int jzero) const
{
dbg<<"SBTopHat fillXImage\n";
dbg<<"x = "<<x0<<" + i * "<<dx<<", izero = "<<izero<<std::endl;
dbg<<"y = "<<y0<<" + j * "<<dy<<", jzero = "<<jzero<<std::endl;
const int m = im.getNCol();
const int n = im.getNRow();
double* ptr = im.getData();
int skip = im.getNSkip();
assert(im.getStep() == 1);
// The columns to consider have -r0 <= y < r0
// given that y = y0 + j dy
double absdx = std::abs(dx);
double absdy = std::abs(dy);
int j1 = std::max(0, int(std::ceil(-_r0/absdy - y0/dy)));
int j2 = std::min(n, int(std::ceil(_r0/absdy - y0/dy)));
y0 += j1 * dy;
ptr += j1*im.getStride();
for (int j=j1; j<j2; ++j,y0+=dy,ptr+=skip) {
double ysq = y0*y0;
double xmax = std::sqrt(_r0sq - ysq);
// Set to _norm all pixels with -xmax <= x < xmax
// given that x = x0 + i dx.
int i1 = std::max(0, int(std::ceil(-xmax/absdx - x0/dx)));
int i2 = std::min(m, int(std::ceil(xmax/absdx - x0/dx)));
int i=0;
for (; i<i1; ++i) ++ptr;
for (; i<i2; ++i) *ptr++ = _norm;
for (; i<m; ++i) ++ptr;
}
}