#ifndef HOG
#define HOG
//#include "cv.h"
//#include "highgui.h"
#include "stdafx.h"
//#include "opencv2\opencv.hpp"
//#include <ml.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace cv;
using namespace std;
class Hogchar
{
public:
Hogchar(){}
Hogchar(Mat ma):mat(ma){}
void getArea(Mat mat);
Mat getAreaHog(Mat mat);
vector<Mat> get(){return vec;}
Mat getCharacter(Mat mat);
private:
Mat mat;
vector<Mat> vec;
};
#endif
错误提示:
1> Hogchar.cpp
1>d:\opencv2\opencv\build\include\opencv2\objdetect\objdetect.hpp(342): error C2059: syntax error : '='
1>d:\opencv2\opencv\build\include\opencv2\objdetect\objdetect.hpp(342): error C3805: '=': unexpected token, expected either '}' or a ','
错误位置的代码:
class CV_EXPORTS FeatureEvaluator
{
public:
enum { HAAR = 0, LBP = 1, HOG = 2 };
virtual ~FeatureEvaluator();
virtual bool read(const FileNode& node);
virtual Ptr<FeatureEvaluator> clone() const;
virtual int getFeatureType() const;
virtual bool setImage(const Mat& img, Size origWinSize);
virtual bool setWindow(Point p);
virtual double calcOrd(int featureIdx) const;
virtual int calcCat(int featureIdx) const;
static Ptr<FeatureEvaluator> create(int type);
};
原因: object 代码中的 enum 类型的HOG 与 定义的
#ifndef HOG
冲突