Windows Opencv HOG运行时异常

Windows Opencv HOG运行时异常,windows,visual-studio,opencv,runtime-error,Windows,Visual Studio,Opencv,Runtime Error,我有以下代码 EducateHOG(string file){ Mat image = imread(file); vector <float> desc; vector <Point> locs; resize(image, image, Size(64,48)); cvtColor(image, image, CV_BGR2GRAY); HogDescriptor hog(Size(32,16), Size(8,8),

我有以下代码

EducateHOG(string file){
    Mat image = imread(file);
    vector <float> desc;
    vector <Point> locs;

    resize(image, image, Size(64,48));
    cvtColor(image, image, CV_BGR2GRAY);
    HogDescriptor hog(Size(32,16), Size(8,8), Size(4,4), Size(4,4), 9);
    hog.compute(image, desc, Size(0,0), Size(0,0), lots); //This cause error
}

我在Win 10上使用Visual Studio 2015和OpenCv库。我找不到这个错误的原因

在项目属性中,链接Opencv库。在
linker->Input->Aditional dependencies
中,确保在调试配置中,您只有opencv_**300d.lib(每个lib都是“D”)。我也有没有opencv_ts300.lib,它的构建还可以。但在debug中运行时,它会在.hog.compute上抛出该异常

我还有其他代码使用OpenCv库(不使用hog)。所以我不认为它来自OpenCv集成。它工作正常。msvcr120.dll与Visual Studio 2015不兼容,因此如何修复该问题。我甚至没有特别提到它。好吧,你必须从Source中构建OpenCV库,看看
Exception thrown at 0x00007FF... (msvcr120.dll) .... Access violating writing location 0x0000258....