本文整理汇总了C++中MatrixXi::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXi::fill方法的具体用法?C++ MatrixXi::fill怎么用?C++ MatrixXi::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixXi
的用法示例。
在下文中一共展示了MatrixXi::fill方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: skip
int
NMS::nms3x3 (MatrixXd &im_, MatrixXd &om_, vector<int> &id_om_)
{
//Sizes
int h_ = im_.rows();
int w_ = im_.cols();
lmn_ = 0;
om_.fill (0); // binary output image
MatrixXi skip (h_,2);
skip.fill (0);
int cur = 0;
int next = 1;
int r, tmp;
for (int c=1; c<w_-1; c++)
{
r = 1;
while (r<h_-1)
{
if (skip(r,cur))
{
// skip current pixel
r=r+1;
continue;
}
if (im_(r,c) <= im_(r+1,c)) // compare to pixel on the left
{
r=r+1;
while ((r<h_-1) && (im_(r,c) <= im_(r+1,c)))
r=r+1; //rising
if (r==h_-1)
break; // reach scanline's local maximum
}
else // compare to pixel on the right
{
if (im_(r,c) <= im_(r-1,c))
{
r=r+1;
continue;
}
}
skip(r+1,cur) = 1; // skip next pixel in the scanline
//compare to 3 future then 3 past neighbors
if (im_(r,c) <= im_(r-1,c+1))
{
r=r+1;
continue;
}
skip(r-1,next) = 1; // skip future neighbors only
if (im_(r,c) <= im_(r ,c+1))
{
r=r+1;
continue;
}
skip(r ,next) = 1;
if (im_(r,c) <= im_(r+1,c+1))
{
r=r+1;
continue;
}
skip(r+1,next) = 1;
if (im_(r,c) <= im_(r-1,c-1))
{
r=r+1;
continue;
}
if (im_(r,c) <= im_(r ,c-1))
{
r=r+1;
continue;
}
if (im_(r,c) <= im_(r+1,c-1))
{
r=r+1;
continue;
}
// a new local maximum is found
om_(r,c) = 1;
id_om_.push_back (r * im_.cols () + c);
lmn_++;
r=r+1;
}
// swap mask indices
tmp = cur;
cur = next;
next = tmp;
// reset next scanline mask
skip.col(next).fill(0);
//.........这里部分代码省略.........