本文整理汇总了C++中idx::str方法的典型用法代码示例。如果您正苦于以下问题:C++ idx::str方法的具体用法?C++ idx::str怎么用?C++ idx::str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idx
的用法示例。
在下文中一共展示了idx::str方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
int display(list<string>::iterator &ifname,
bool signd, bool load, list<string> *mats) {
//cout << "displaying " << ifname->c_str() << endl;
// conf mode
if (conf)
return display_net<T>(ifname, signd, load, mats);
// mat mode
if (is_matrix(ifname->c_str())) {
idxdim d = get_matrix_dims(ifname->c_str());
if (interleaved)
d.shift_dim(0, 2);
if (save_individually || print
|| !(d.order() == 2 || (d.order() == 3 &&
(d.dim(2) == 1 || d.dim(2) == 3)))) {
// this is probably not an image, just display info and print matrix
string type;
get_matrix_type(ifname->c_str(), type);
idx<T> m = load_matrix<T>(ifname->c_str());
cout << "Matrix " << ifname->c_str() << " is of type " << type
<< " with dimensions " << d << " (min " << idx_min(m)
<< ", max " << idx_max(m) << ", mean " << idx_mean(m)
<< "):" << endl;
m.print();
if (has_multiple_matrices(ifname->c_str())) {
midx<T> ms = load_matrices<T>(ifname->c_str(), true);
// saving sub-matrices
if (save_individually) {
cout << "Saving each sub-matrix of " << *ifname << " individually..."
<< endl;
save_matrices_individually(ms, *ifname, true);
}
// printing sub-matrices
cout << "This file contains " << m << " matrices: ";
if (ms.order() == 1) {
for (intg i = 0; i < ms.dim(0); ++i) {
idx<T> tmp = ms.mget(i);
cout << tmp.info() << " ";
}
} else if (ms.order() == 2) {
for (intg i = 0; i < ms.dim(0); ++i) {
for (intg j = 0; j < ms.dim(1); ++j) {
idx<T> tmp = ms.mget(i, j);
cout << tmp.info() << " ";
}
cout << endl;
}
}
cout << endl;
} else
cout << "This is a single-matrix file." << endl;
return 0;
}
}
// image mode
int loaded = 0;
static idx<T> mat;
uint h = 0, w = 0, rowh = 0, maxh = 0;
list<string>::iterator fname = ifname;
#ifdef __GUI__
disable_window_updates();
clear_window();
if (show_filename) {
gui << at(h, w) << black_on_white() << ifname->c_str();
h += 16;
}
#endif
maxh = h;
for (uint i = 0; i < nh; ++i) {
rowh = maxh;
for (uint j = 0; j < nw; ++j) {
if (fname == mats->end())
fname = mats->begin();
try {
// if (load)
mat = load_image<T>(*fname);
if (print)
cout << *fname << ": " << mat << endl << mat.str() << endl;
// show only some channels
if (chans >= 0)
mat = mat.select(2, chans);
loaded++;
maxh = (std::max)(maxh, (uint) (rowh + mat.dim(0)));
T min = 0, max = 0;
#ifdef __GUI__
if (autorange || signd) {
if (autorange) {
min = idx_min(mat);
max = idx_max(mat);
} else if (signd) {
T matmin = idx_min(mat);
if ((double)matmin < 0) {
min = -1;
max = -1;
}
}
draw_matrix(mat, rowh, w, zoom, zoom, min, max);
} else
draw_matrix(mat, rowh, w, zoom, zoom, (T) range[0], (T) range[1]);
#endif
w += mat.dim(1) + 1;
//.........这里部分代码省略.........