本文整理汇总了C++中Oiiotool::error方法的典型用法代码示例。如果您正苦于以下问题:C++ Oiiotool::error方法的具体用法?C++ Oiiotool::error怎么用?C++ Oiiotool::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oiiotool
的用法示例。
在下文中一共展示了Oiiotool::error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: string
static std::string
compute_sha1 (Oiiotool &ot, ImageInput *input)
{
SHA1 sha;
const ImageSpec &spec (input->spec());
if (spec.deep) {
// Special handling of deep data
DeepData dd;
if (! input->read_native_deep_image (dd)) {
ot.error (" SHA-1: unable to compute, could not read image\n");
return std::string();
}
// Hash both the sample counts and the data block
sha.append (dd.all_samples());
sha.append (dd.all_data());
} else {
imagesize_t size = input->spec().image_bytes (true /*native*/);
if (size >= std::numeric_limits<size_t>::max()) {
ot.error (" SHA-1: unable to compute, image is too big\n");
return std::string();
}
else if (size != 0) {
boost::scoped_array<char> buf (new char [size]);
if (! input->read_image (TypeDesc::UNKNOWN /*native*/, &buf[0])) {
ot.error (" SHA-1: unable to compute, could not read image\n");
return std::string();
}
sha.append (&buf[0], size);
}
}
return sha.digest().c_str();
}
示例2: nonfinite_pixel_samp
static void
print_stats (Oiiotool &ot,
const std::string &filename,
const ImageSpec &originalspec,
int subimage=0, int miplevel=0, bool indentmip=false)
{
const char *indent = indentmip ? " " : " ";
ImageBuf input;
if (! read_input (filename, input, subimage, miplevel)) {
ot.error ("stats", input.geterror());
return;
}
PixelStats stats;
if (! computePixelStats (stats, input)) {
std::string err = input.geterror();
ot.error ("stats", Strutil::format ("unable to compute: %s",
err.empty() ? "unspecified error" : err.c_str()));
return;
}
// The original spec is used, otherwise the bit depth will
// be reported incorrectly (as FLOAT)
unsigned int maxval = (unsigned int)get_intsample_maxval (originalspec);
printf ("%sStats Min: ", indent);
for (unsigned int i=0; i<stats.min.size(); ++i) {
print_stats_num (stats.min[i], maxval, true);
printf (" ");
}
print_stats_footer (maxval);
printf ("\n");
printf ("%sStats Max: ", indent);
for (unsigned int i=0; i<stats.max.size(); ++i) {
print_stats_num (stats.max[i], maxval, true);
printf (" ");
}
print_stats_footer (maxval);
printf ("\n");
printf ("%sStats Avg: ", indent);
for (unsigned int i=0; i<stats.avg.size(); ++i) {
print_stats_num (stats.avg[i], maxval, false);
printf (" ");
}
print_stats_footer (maxval);
printf ("\n");
printf ("%sStats StdDev: ", indent);
for (unsigned int i=0; i<stats.stddev.size(); ++i) {
print_stats_num (stats.stddev[i], maxval, false);
printf (" ");
}
print_stats_footer (maxval);
printf ("\n");
printf ("%sStats NanCount: ", indent);
for (unsigned int i=0; i<stats.nancount.size(); ++i) {
printf ("%llu ", (unsigned long long)stats.nancount[i]);
}
printf ("\n");
printf ("%sStats InfCount: ", indent);
for (unsigned int i=0; i<stats.infcount.size(); ++i) {
printf ("%llu ", (unsigned long long)stats.infcount[i]);
}
printf ("\n");
printf ("%sStats FiniteCount: ", indent);
for (unsigned int i=0; i<stats.finitecount.size(); ++i) {
printf ("%llu ", (unsigned long long)stats.finitecount[i]);
}
printf ("\n");
if (input.deep()) {
const DeepData *dd (input.deepdata());
size_t npixels = dd->pixels();
size_t totalsamples = 0, emptypixels = 0;
size_t maxsamples = 0, minsamples = std::numeric_limits<size_t>::max();
size_t maxsamples_npixels = 0;
float mindepth = std::numeric_limits<float>::max();
float maxdepth = -std::numeric_limits<float>::max();
Imath::V3i maxsamples_pixel(-1,-1,-1), minsamples_pixel(-1,-1,-1);
Imath::V3i mindepth_pixel(-1,-1,-1), maxdepth_pixel(-1,-1,-1);
Imath::V3i nonfinite_pixel(-1,-1,-1);
int nonfinite_pixel_samp(-1), nonfinite_pixel_chan(-1);
size_t sampoffset = 0;
int nchannels = dd->channels();
int depthchannel = -1;
long long nonfinites = 0;
for (int c = 0; c < nchannels; ++c)
if (Strutil::iequals (originalspec.channelnames[c], "Z"))
depthchannel = c;
int xend = originalspec.x + originalspec.width;
int yend = originalspec.y + originalspec.height;
int zend = originalspec.z + originalspec.depth;
size_t p = 0;
std::vector<size_t> nsamples_histogram;
for (int z = originalspec.z; z < zend; ++z) {
//.........这里部分代码省略.........