本文整理汇总了C++中common::Timer::restart方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::restart方法的具体用法?C++ Timer::restart怎么用?C++ Timer::restart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Timer
的用法示例。
在下文中一共展示了Timer::restart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onNewImage
void CvSIFT::onNewImage() {
LOG(LTRACE)<< "CvSIFT::onNewImage\n";
try {
// Input: a grayscale image.
cv::Mat input = in_img.read();
std::ofstream feature_calc_time;
if(!string(prop_calc_path).empty()) {
feature_calc_time.open((string(prop_calc_path)+string("czas_wyznaczenia_cech_sift.txt")).c_str(), ios::out|ios::app);
}
Common::Timer timer;
timer.restart();
//-- Step 1: Detect the keypoints.
cv::SiftFeatureDetector detector(0,4);
std::vector<cv::KeyPoint> keypoints;
detector.detect(input, keypoints);
//-- Step 2: Calculate descriptors (feature vectors).
cv::SiftDescriptorExtractor extractor;
Mat descriptors;
extractor.compute( input, keypoints, descriptors);
if(!string(prop_calc_path).empty()) {
feature_calc_time << timer.elapsed() << endl;
}
// Write results to outputs.
Types::Features features(keypoints);
features.type = "SIFT";
out_features.write(features);
out_descriptors.write(descriptors);
} catch (...) {
LOG(LERROR) << "CvSIFT::onNewImage failed\n";
}
}
示例2: onNewImage
void BlobExtractor_Processor::onNewImage() {
LOG(LTRACE) << "BlobExtractor_Processor::onNewImage() called!\n";
Common::Timer timer;
timer.restart();
cv::Mat in = in_img.read();
in.convertTo(img_uchar, CV_8UC1);
IplImage ipl_img = IplImage(img_uchar);
// cv::Mat mat_img = img_uchar;
// cv::Mat out = cv::Mat::zeros(in.size(), CV_8UC3);
Types::Blobs::Blob_vector res;
bool success;
try
{
success = ComponentLabeling( &ipl_img, NULL, props.bkg_color, res );
}
catch(...)
{
success = false;
LOG(LWARNING) << "blob find error\n";
}
try {
if( !success ) {
LOG(LERROR) << "Blob find error\n";
} else {
LOG(LTRACE) << "blobs found";
Types::Blobs::BlobResult result(res);
result.Filter( result, B_EXCLUDE, Types::Blobs::BlobGetArea(), B_LESS, min_size );
out_blobs.write(result);
LOG(LTRACE) << "blobs written";
newBlobs->raise();
LOG(LTRACE) << "blobs sent";
// result.draw(out, CV_RGB(255, 0, 0), 0, 0);
// out_img.write(in);
// newImage->raise();
}
LOG(LINFO) << "Blobing took " << timer.elapsed() << " seconds\n";
}
catch(...)
{
LOG(LERROR) << "BlobExtractor onNewImage failure";
}
}