0

I'm facing a very annoying problem when I create an object of FalnnBaseMatcher.

The code is the following and it worked fine on ubuntu under eclipse.

#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;
}

it compiles but when i run i got an access violation. I tried to split the problem and i figured out that i have this error when i create the object FlannBasedMatcher matcher;

Any help is accepted, thank you very much.

I'm using visual studio express edition 2012 and opencv 242 under windows 7.

Now modifying slightly the code I get an interuption in free.c

/***

*free.c - free an entry in the heap * * Copyright (c) Microsoft Corporation. All rights reserved. * *Purpose: * Defines the following functions: * free() - free a memory block in the heap * *******************************************************************************/

#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());
    }
}

The interruption is in: if (retval == 0)

SOLVED!

I rebuilt openCv for VisualStudio 2012 using cMake and now works fine.

4

0 回答 0