使用flann匹配器访问冲突

时间:2014-01-27 16:44:23

标签: c++ opencv access-violation flann

当我创建一个FalnnBaseMatcher对象时,我遇到了一个非常烦人的问题。

代码如下,它在eclipse下的ubuntu上工作正常。

#include <iostream>
#include "C:\openCv\opencv\build\include\opencv2\core\core.hpp"
#include "C:\openCv\opencv\build\include\opencv2\highgui\highgui.hpp"
#include "C:\openCv\opencv\build\include\opencv2\imgproc\imgproc.hpp"
#include "C:\openCv\opencv\build\include\opencv2\features2d\features2d.hpp"
#include "C:\openCv\opencv\build\include\opencv2\nonfree\nonfree.hpp"

using namespace std;
using namespace cv;





int main(){

cv::VideoCapture cap("video2.mp4");

if(!cap.isOpened()){  // check if we succeeded
    return -1;
}

Mat frame; // creates the object frame

FlannBasedMatcher matcher; //create object matcher


return 0;
}

它编译,但当我运行时,我有一个访问冲突。我试图分裂问题,当我创建对象FlannBasedMatcher匹配器时,我发现我有这个错误;

接受任何帮助,非常感谢。

我在Windows 7下使用visual studio express edition 2012和opencv 242。

现在略微修改代码我在free.c中进行了一次中断

/***

* free.c - 释放堆中的条目 * *版权所有(c)Microsoft Corporation。版权所有。 * *目的: *定义以下功能: * free() - 释放堆中的内存块 * ************************************************** ******** /

#include <cruntime.h>
#include <malloc.h>
#include <winheap.h>
#include <windows.h>
#include <internal.h>
#include <mtdll.h>
#include <dbgint.h>
#include <rtcsup.h>

/***
*void free(pblock) - free a block in the heap
*
*Purpose:
*       Free a memory block in the heap.
*
*       Special ANSI Requirements:
*
*       (1) free(NULL) is benign.
*
*Entry:
*       void *pblock - pointer to a memory block in the heap
*
*Return:
*       <void>
*
*******************************************************************************/

void __cdecl _free_base (void * pBlock)
{

    int retval = 0;


    if (pBlock == NULL)
        return;

    RTCCALLBACK(_RTC_Free_hook, (pBlock, 0));

    retval = HeapFree(_crtheap, 0, pBlock);
    if (retval == 0)
    {
        errno = _get_errno_from_oserr(GetLastError());
    }
}

中断在:if(retval == 0)

解决!

我使用cMake为VisualStudio 2012重建了openCv,现在工作正常。

0 个答案:

没有答案