From 3535d27aff2ffab30c435cd8dfad544c95a615ca Mon Sep 17 00:00:00 2001 From: asantamaria <asantamaria@iri.upc.edu> Date: Thu, 31 May 2018 17:26:27 +0200 Subject: [PATCH] Add total time clock --- src/examples/fundamental_matrix.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/examples/fundamental_matrix.cpp b/src/examples/fundamental_matrix.cpp index 14394fb..98ffef9 100644 --- a/src/examples/fundamental_matrix.cpp +++ b/src/examples/fundamental_matrix.cpp @@ -154,7 +154,7 @@ int main(int argc, char** argv) cv::Mat descriptors_1 = des_ptr->getDescriptor( image_buffer.back(), keypoints_1); clock_t tStart, tDet, tDesc, tMatch, tFilter, tFund; - double t_det(0), t_desc(0), t_match(0), t_filter(0), t_fund(0); + double t_det(0), t_desc(0), t_match(0), t_filter(0), t_fund(0), t_total(0); const int CLOCKS_PER_MSEC = (CLOCKS_PER_SEC/1000); int n_iter = 0; @@ -196,8 +196,8 @@ int main(int argc, char** argv) if (keypoints_1.size() * keypoints_2.size() != 0) { // match (try flann later) - //-- Step 3: Matching descriptor vectors using FLANN matcher - mat_ptr->match(descriptors_1,descriptors_2,des_ptr->getSize(),matches); + //-- Step 3: Matching descriptor vectors + mat_ptr->match(descriptors_1,descriptors_2,des_ptr->getSize(),matches); //-- Quick calculation of max and min distances between keypoints for (int ii = 0; ii < descriptors_1.rows; ii++) @@ -221,7 +221,7 @@ int main(int argc, char** argv) //-- Select only "good" matches (i.e. those at a distance which is small) for (unsigned int ii = 0; ii < matches.size(); ii++) { - if (matches[ii].distance <= 50) //std::max(2*min_dist, 0.02) ) + if (matches[ii].distance <= 20) //std::max(2*min_dist, 0.02) ) { good_matches.push_back(matches[ii]); matched_1.push_back(keypoints_1[matches[ii].queryIdx].pt); @@ -260,8 +260,9 @@ int main(int argc, char** argv) t_match += double( tMatch - tDesc )/CLOCKS_PER_MSEC; t_filter += double(tFilter - tMatch )/CLOCKS_PER_MSEC; t_fund += double( tFund - tFilter)/CLOCKS_PER_MSEC; + t_total += double(clock() - tStart )/CLOCKS_PER_MSEC; - std::cout << "det: " << t_det/n_iter << "ms - desc: " << t_desc/n_iter << "ms - match: " << t_match/n_iter << "ms - filter: " << t_filter/n_iter << "ms - found: " << t_fund/n_iter << "ms" << std::endl; + std::cout << "det: " << t_det/n_iter << "ms - desc: " << t_desc/n_iter << "ms - match: " << t_match/n_iter << "ms - filter: " << t_filter/n_iter << "ms - found: " << t_fund/n_iter << "ms - Total: " << t_total/n_iter << "ms" << std::endl; std::cout << "+++++++++++++++" << std::endl; -- GitLab