Skip to content
Snippets Groups Projects
Commit 3535d27a authored by Angel Santamaria-Navarro's avatar Angel Santamaria-Navarro
Browse files

Add total time clock

parent 49fdd69a
No related branches found
No related tags found
No related merge requests found
...@@ -154,7 +154,7 @@ int main(int argc, char** argv) ...@@ -154,7 +154,7 @@ int main(int argc, char** argv)
cv::Mat descriptors_1 = des_ptr->getDescriptor( image_buffer.back(), keypoints_1); cv::Mat descriptors_1 = des_ptr->getDescriptor( image_buffer.back(), keypoints_1);
clock_t tStart, tDet, tDesc, tMatch, tFilter, tFund; 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); const int CLOCKS_PER_MSEC = (CLOCKS_PER_SEC/1000);
int n_iter = 0; int n_iter = 0;
...@@ -196,8 +196,8 @@ int main(int argc, char** argv) ...@@ -196,8 +196,8 @@ int main(int argc, char** argv)
if (keypoints_1.size() * keypoints_2.size() != 0) if (keypoints_1.size() * keypoints_2.size() != 0)
{ {
// match (try flann later) // match (try flann later)
//-- Step 3: Matching descriptor vectors using FLANN matcher //-- Step 3: Matching descriptor vectors
mat_ptr->match(descriptors_1,descriptors_2,des_ptr->getSize(),matches); mat_ptr->match(descriptors_1,descriptors_2,des_ptr->getSize(),matches);
//-- Quick calculation of max and min distances between keypoints //-- Quick calculation of max and min distances between keypoints
for (int ii = 0; ii < descriptors_1.rows; ii++) for (int ii = 0; ii < descriptors_1.rows; ii++)
...@@ -221,7 +221,7 @@ int main(int argc, char** argv) ...@@ -221,7 +221,7 @@ int main(int argc, char** argv)
//-- Select only "good" matches (i.e. those at a distance which is small) //-- Select only "good" matches (i.e. those at a distance which is small)
for (unsigned int ii = 0; ii < matches.size(); ii++) 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]); good_matches.push_back(matches[ii]);
matched_1.push_back(keypoints_1[matches[ii].queryIdx].pt); matched_1.push_back(keypoints_1[matches[ii].queryIdx].pt);
...@@ -260,8 +260,9 @@ int main(int argc, char** argv) ...@@ -260,8 +260,9 @@ int main(int argc, char** argv)
t_match += double( tMatch - tDesc )/CLOCKS_PER_MSEC; t_match += double( tMatch - tDesc )/CLOCKS_PER_MSEC;
t_filter += double(tFilter - tMatch )/CLOCKS_PER_MSEC; t_filter += double(tFilter - tMatch )/CLOCKS_PER_MSEC;
t_fund += double( tFund - tFilter)/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; std::cout << "+++++++++++++++" << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment