Using FlannBasedMatcher. Exception.

asked 2013-10-28 01:00:16 -0500

gigaVolter gravatar image

updated 2013-10-30 08:54:57 -0500

Hello. i'm using opencv 2.4.4 on windows 7, vs 2010, c++. I implement features find task in mfc application. Here i have some code:

 void CWorkClass::PrepareGoodMatches(cv::Mat mat1, cv::Mat mat2, vector<cv::DMatch>& out)
        cv::FlannBasedMatcher matcher;
        vector<cv::DMatch> matchVec;//leftCenterMatchVec, centerRightMatchVec;
        matcher.match(mat1, mat2, matchVec);
        double maxDist = 0;
        double minDist = 100000;
        for (unsigned int i = 0;i<matchVec.size();i++){
            double curDist =;
            if (curDist < minDist) minDist = curDist;
            if (curDist > maxDist) maxDist = curDist;
        for (unsigned int i = 0;i<matchVec.size();i++){
            if ( < (3 * minDist))

After exit of this function i have different kinds of exceptions: 1) In OnCmdMSg(...) on return _AfxDispatchCmdMsg(this, nID, nCode, lpEntry->pfn, pExtra, lpEntry->nSig, pHandlerInfo); 2) _CrtIsValidHeapPointer(pUserData) (if i hit continue) 3) exception in ~DescriptorMatcher.

if therese no implemention of cv::FlannBasedMatcher matcher, this function return good. Please give me advice to solve this problem.

.... UPDATE .... My problem solved after i replace all opencv dll's i used in my project from origin package... i waste about 3 days (

...UPADTE 2... Really problem was that i used MFC as static lib, after i change to DLL, problem solved

edit retag flag offensive close merge delete


Wow thanks man, you saved me some precious time!

Stoo gravatar imageStoo ( 2014-05-19 23:09:56 -0500 )edit