本文整理汇总了C++中scoped_ptr::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ scoped_ptr::Next方法的具体用法?C++ scoped_ptr::Next怎么用?C++ scoped_ptr::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scoped_ptr
的用法示例。
在下文中一共展示了scoped_ptr::Next方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetChannelMean
vector<double> GetChannelMean(scoped_ptr<db::Cursor>& cursor)
{
vector<double> meanv(3, 0);
int count = 0;
LOG(INFO) << "Starting Iteration";
while (cursor->valid()) {
Datum datum;
datum.ParseFromString(cursor->value());
DecodeDatumNative(&datum);
const std::string& data = datum.data();
int w = datum.width(), h = datum.height();
int ch = datum.channels();
int dim = w*h;
double chmean[3] = { 0,0,0 };
for (int i = 0; i < ch;i++)
{
int chstart = i*dim;
for (int j = 0; j < dim;j++)
chmean[i] += (uint8_t)data[chstart+j];
chmean[i] /= dim;
}
if (ch == 1)
{
meanv[0] += chmean[0];
meanv[1] += chmean[0];
meanv[2] += chmean[0];
}
else
{
meanv[0] += chmean[0];
meanv[1] += chmean[1];
meanv[2] += chmean[2];
}
++count;
if (count % 10000 == 0) {
LOG(INFO) << "Processed " << count << " files.";
}
cursor->Next();
}
if (count % 10000 != 0) {
LOG(INFO) << "Processed " << count << " files.";
}
for (int c = 0; c < 3; ++c) {
LOG(INFO) << "mean_value channel [" << c << "]:" << meanv[c] / count;
}
return meanv;
}