opencv3.1,detectMultiScale,访问违规写作

时间:2016-07-20 08:52:23

标签: c++ opencv detect

这是我使用opencv3.1检测内容的代码。

但函数fp.detectMultiScale总是出错

'예외가throw됨:쓰기액세스위반입니다。这이(가)0x10였습니다。'

英文'错误被抛出:访问违规写作。这是0x10。'

请帮助我修复它......

我已经用Google搜索了3天......

如果您需要,我很高兴添加您想要的视觉工作室的消息。

#include<opencv\cv.h>
#include<opencv\highgui.h>
#include<opencv2\core\core.hpp>
#include<opencv2\imgcodecs.hpp>
#include<opencv2\highgui\highgui.hpp>
#include<opencv2/world.hpp>
#include<iostream>
#include<stdio.h>
#include<opencv2\objdetect\objdetect.hpp>
#include<opencv2\imgproc\imgproc.hpp>
using namespace std;
using namespace cv;
String fp_cascade = "C:\\hhhh\\CascadeTrainer\\cascade15\\cascade.xml";
CascadeClassifier fp;

void detect(Mat frame)
{
    vector<Rect> fps;
    fps.clear();
    Mat frame_gray;
    cvtColor(frame, frame_gray, CV_BGR2GRAY);
    equalizeHist(frame_gray, frame_gray); 
    fp.detectMultiScale(frame_gray, fps, 1.1, 1 , 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
    printf("%d", fps.size());

}

void main() {
    if (fp.load(fp_cascade)) {
        printf("111111");
    }

    Mat img = imread("C:\\hhhh\\sample\\qwe.jpg");
    detect(img);
    getchar();

}

0 个答案:

没有答案