本文整理汇总了C++中Stopwatch::print方法的典型用法代码示例。如果您正苦于以下问题:C++ Stopwatch::print方法的具体用法?C++ Stopwatch::print怎么用?C++ Stopwatch::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stopwatch
的用法示例。
在下文中一共展示了Stopwatch::print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: running_time
cv::Mat1b GraphSeg::execute(const multi_img& input,
const cv::Mat1b& seeds,
cv::Mat1b *proba_map) {
Stopwatch running_time("Total Running Time");
cv::Mat1b output;
int i;
if ((seeds.cols != input.width)||(seeds.rows != input.height)) {
std::cerr << "ERROR: Seed file dimensions do not match image dimensions!"
<< std::endl;
return output; // which is empty so far
}
Graph graph(seeds.cols, seeds.rows);
/* extract seeds */
cv::Mat1b::const_iterator it;
if (config.multi_seed == true) { // multilabel seed image
graph.max_label = 0;
for (i = 0, it = seeds.begin(); it < seeds.end(); ++i, ++it) {
if (*it > 0) {
graph.seeds.push_back(std::make_pair(i, *it));
if (*it > graph.max_label)
graph.max_label = *it;
}
}
} else {
graph.max_label = 2;
for (i = 0, it = seeds.begin(); it < seeds.end(); ++i, ++it) {
if (*it > 192) {
graph.seeds.push_back(std::make_pair(i, 1));
} else if (*it < 64) {
graph.seeds.push_back(std::make_pair(i, 2));
}
}
}
// edge weights
similarity_measures::SimilarityMeasure<multi_img::Value> *distfun;
#ifdef WITH_SOM
boost::shared_ptr<som::GenSOM> som; // create in this scope for survival
if (!config.som_similarity) {
distfun = similarity_measures::SMFactory<multi_img::Value>
::spawn(config.similarity);
} else {
input.rebuildPixels();
som = boost::shared_ptr<som::GenSOM>(
som::GenSOM::create(config.som, input));
distfun = new som::SOMDistance<multi_img::Value>(*som, input);
}
#else
distfun = SMFactory<multi_img::Value>::spawn(config.similarity);
#endif
assert(distfun);
Stopwatch watch;
if (config.algo == WATERSHED2) {
/* Kruskal & RW on plateaus multiseeds linear time */
graph.color_standard_weights(input, distfun, true);
watch.print_reset("Graph coloring");
// for PW, color_standard_weights is always called with geodesic = true
output = graph.PowerWatershed_q2(config.geodesic, proba_map);
watch.print("Segmentation");
} else {
graph.color_standard_weights(input, distfun, config.geodesic);
watch.print_reset("Graph coloring");
if (config.algo == KRUSKAL) { // Kruskal
output = graph.MSF_Kruskal();
} else if (config.algo == PRIM) { // Prim RB tree
output = graph.MSF_Prim();
}
watch.print("Segmentation");
}
delete distfun;
return output;
}