Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Algorithm OpenCV中的人脸识别器_Algorithm_Opencv_Face Recognition - Fatal编程技术网

Algorithm OpenCV中的人脸识别器

Algorithm OpenCV中的人脸识别器,algorithm,opencv,face-recognition,Algorithm,Opencv,Face Recognition,我正在读这篇文章 并尝试运行代码facerec\u lbph.cpp。但是,我遇到了以下错误: facerec_lbph.cpp:109:9: error: ‘FaceRecognizer’ was not declared in this scope facerec_lbph.cpp:109:23: error: template argument 1 is invalid facerec_lbph.cpp:109:31: error: invalid type in declaration

我正在读这篇文章

并尝试运行代码
facerec\u lbph.cpp
。但是,我遇到了以下错误:

facerec_lbph.cpp:109:9: error: ‘FaceRecognizer’ was not declared in this scope
facerec_lbph.cpp:109:23: error: template argument 1 is invalid
facerec_lbph.cpp:109:31: error: invalid type in declaration before ‘=’ token
facerec_lbph.cpp:109:58: error: ‘createLBPHFaceRecognizer’ was not declared in this scope
facerec_lbph.cpp:110:10: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:113:31: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:132:10: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:136:27: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:144:18: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:145:18: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:146:18: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:147:18: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:148:18: error: base operand of ‘->’ is not a pointer
facerec_lbph.cpp:151:35: error: base operand of ‘->’ is not a pointer
OpenCV版本是

opencv-2.3.1-3.fc16.x86_64
opencv-python-2.3.1-3.fc16.x86_64
opencv-devel-2.3.1-3.fc16.x86_64
opencv-devel-docs-2.3.1-3.fc16.noarch
系统版本为fedora 16,即64位。我使用的makefile是:

CC = g++

SRC = facerec_lbph.cpp
TARGET = main

OBJS = facerec_lbph.o


INCDIRS = -I/usr/include/opencv -I/usr/include/opencv2
LIBDIRS = -L/usr/lib64

CFLAGS = -g $(INCDIRS)
LFLAGS = -lopencv_core -lopencv_highgui -lopencv_video -lopencv_imgproc -lopencv_objdetect -lopencv_ml -lopencv_contrib


all: $(OBJS)
    $(CC) -o $(TARGET) $(OBJS) $(INCDIRS) $(LIBDIRS) $(LFLAGS)
main.o: $(SRC) $(INCLUDE)
    $(CC) -c $(SRC) $(INCLUDE) $(INCDIRS) $(LIBDIRS) $(LFLAGS)

clean:
    rm -f $(TARGET) $(OBJS) *.gch

我可以在需要新信息时更新错误报告。谢谢

问题是,您使用的是OpenCV 2.3.1。这个OpenCV版本还没有cv::FaceRecognitor,所以这就解释了您的错误消息。我强烈建议您更新到OpenCV 2.4.2

文档附带了很多示例:

但是,如果无法更新到最新的OpenCV版本,也可以尝试使用的0.03版(libfacerec是我为OpenCV贡献的项目)。它与所有OpenCV 2.3版本兼容。它有一个稍微不同的接口,但算法相同。以下是可用的标签,您可以下载:


谢谢!我原以为有些类是在src文件夹中包含的文件中定义的,但经过短暂的阅读,我认为可能错误仍然是由于库链接造成的。所以我编辑了上面的问题。哦,我刚刚看到了你的更新答案,我使用的是OpenCV 2.3.1,算法概念是从2.4版本开始引入的。非常感谢你!