# HG changeset patch # User Nicolas Saunier # Date 1341287379 14400 # Node ID 249d65ff6c35596e3bd95a55971b14f9048bb7f6 # Parent bc4ea09b1743e5b6067ed202da04e8370147211a# Parent 6e73b112370b4168cb0c98f45b87bbbf0c94532a merged modifications for windows diff -r 6e73b112370b -r 249d65ff6c35 c/Motion.cpp --- a/c/Motion.cpp Fri Jun 29 10:27:46 2012 -0400 +++ b/c/Motion.cpp Mon Jul 02 23:49:39 2012 -0400 @@ -164,7 +164,7 @@ if (ft->minMaxSimilarity(*ft2, firstInstant, lastInstant, connectionDistance, segmentationDistance)) { UndirectedGraph::edge_descriptor e; bool unused; - tie(e, unused) = add_edge(newVertex, *vi, graph); + tr1::tie(e, unused) = add_edge(newVertex, *vi, graph); // no need to add measures to graph[e] (edge properties) } } @@ -185,7 +185,7 @@ vector > tmpobjects(num), objects; // vector of components (component = vector of vertex descriptors) graph_traits::vertex_iterator vi, vend; - for(tie(vi,vend) = vertices(graph); vi != vend; ++vi) { + for(tr1::tie(vi,vend) = vertices(graph); vi != vend; ++vi) { unsigned int id = components[*vi]; lastInstants[id] = max(lastInstants[id], graph[*vi].feature->getLastInstant()); tmpobjects[id].push_back(*vi); @@ -246,6 +246,6 @@ void FeatureGraph::computeVertexIndex(void) { graph_traits::vertex_iterator vi, vend; graph_traits::vertices_size_type cnt = 0; - for(tie(vi,vend) = vertices(graph); vi != vend; ++vi) + for(tr1::tie(vi,vend) = vertices(graph); vi != vend; ++vi) graph[*vi].index = cnt++; } diff -r 6e73b112370b -r 249d65ff6c35 c/Parameters.cpp --- a/c/Parameters.cpp Fri Jun 29 10:27:46 2012 -0400 +++ b/c/Parameters.cpp Mon Jul 02 23:49:39 2012 -0400 @@ -9,7 +9,7 @@ using namespace std; KLTFeatureTrackingParameters::KLTFeatureTrackingParameters(const int argc, char* argv[]) { - std::string configurationFilename; + string configurationFilename; po::options_description onlyCmdLine("Command line only"); po::options_description cmdLineAndFile("Command line and configuration file"); diff -r 6e73b112370b -r 249d65ff6c35 c/feature-based-tracking.cpp --- a/c/feature-based-tracking.cpp Fri Jun 29 10:27:46 2012 -0400 +++ b/c/feature-based-tracking.cpp Mon Jul 02 23:49:39 2012 -0400 @@ -111,14 +111,14 @@ trajectoryDB->createTable("velocities"); trajectoryDB->beginTransaction(); - vector prevKpts, currKpts; - vector prevPts, currPts, newPts; - vector status; - vector errors; + std::vector prevKpts, currKpts; + std::vector prevPts, currPts, newPts; + std::vector status; + std::vector errors; Mat prevDesc, currDesc; - vector lostFeatures; - vector featurePointMatches; + std::vector lostFeatures; + std::vector featurePointMatches; HOGDescriptor hog; hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector()); @@ -148,7 +148,6 @@ // } cvtColor(frame, currentFrameBW, CV_RGB2GRAY); - // "normal" feature detectors: detect features here // detector.detect(currentFrameBW, currKpts); // see video_homography c++ sample @@ -158,8 +157,8 @@ calcOpticalFlowPyrLK(previousFrameBW, currentFrameBW, prevPts, currPts, status, errors, window, params.pyramidLevel, TermCriteria(3 /*static_cast(TermCriteria::COUNT)+static_cast(TermCriteria::EPS)*/, params.maxNumberTrackingIterations, params.minTrackingError), 0.5 /* unused */, 0); // OPTFLOW_USE_INITIAL_FLOW /// \todo try calcOpticalFlowFarneback - vector trackedPts; - vector::iterator iter = featurePointMatches.begin(); + std::vector trackedPts; + std::vector::iterator iter = featurePointMatches.begin(); while (iter != featurePointMatches.end()) { bool deleteFeature = false; @@ -282,7 +281,7 @@ lastFrameNum = MIN(lastFrameNum,params.frame1+params.nFrames); for (frameNum = firstFrameNum; frameNum trajectoryIds; - success = trajectoryDB->trajectoryIdEndingAt(trajectoryIds, frameNum); // ending + success = trajectoryDB->trajectoryIdEndingAt(trajectoryIds, frameNum); if (frameNum%100 ==0) cout << "frame " << frameNum << endl; //success = trajectoryDB->trajectoryIdInInterval(trajectoryIds, frameNum, min(frameNum+queryIntervalLength-1, frameNum+params.nFrames)); // ending @@ -306,7 +305,7 @@ // check for connected components int lastInstant = frameNum+params.minFeatureTime-maxTrajectoryLength; - if (lastInstant > 0) { + if (lastInstant > 0 && frameNum%10==0) { featureGraph.connectedComponents(lastInstant); vector > featureGroups = featureGraph.getFeatureGroups(); for (unsigned int i=0; i #include +/* MSVC does not have lrintf */ +#ifdef _MSC_VER +static inline long lrintf(float f){ +/* x64 does not supported embedded assembly */ +#ifdef _M_X64 + return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); +#else + int i; + + _asm{ + fld f + fistp i + }; + + return i; +#endif +} +#endif + using namespace std; void videoTiming(CvCapture* inputVideo) { diff -r 6e73b112370b -r 249d65ff6c35 c/test_graph.cpp diff -r 6e73b112370b -r 249d65ff6c35 c/utils.cpp --- a/c/utils.cpp Fri Jun 29 10:27:46 2012 -0400 +++ b/c/utils.cpp Mon Jul 02 23:49:39 2012 -0400 @@ -8,16 +8,16 @@ using namespace std; -vector > loadNumbers(const string& filename, const string& separator /* = " " */) { +std::vector > loadNumbers(const string& filename, const string& separator /* = " " */) { ifstream in(filename.c_str()); - vector > result; + std::vector > result; if (::openCheck(in, filename, "loadNumbers")) { while (!in.eof()) { string line = ::getlineComment(in); - vector tokens; + std::vector tokens; ::split(tokens, line, separator); - vector numbers; + std::vector numbers; BOOST_FOREACH(string s, tokens) numbers.push_back(::toFloat(s)); if (!numbers.empty()) diff -r 6e73b112370b -r 249d65ff6c35 include/Motion.hpp --- a/include/Motion.hpp Fri Jun 29 10:27:46 2012 -0400 +++ b/include/Motion.hpp Mon Jul 02 23:49:39 2012 -0400 @@ -2,7 +2,6 @@ #define MOTION_HPP #include "src/Trajectory.h" - #include #include