开始使用的opencv3.2版本,并完成了分类器训练,之后切换到了3.3版本,
在人脸识别时一直报错:
D:opencv3.2sourcessamplescppexample_cmakeface-recfacerec>facerec.exe
begin
frame.empty() 0
OpenCV Error: Unspecified error (This Eigenfaces model is not computed yet. Did
you call Eigenfaces::train?) in predict, file D:opencv3.3sourcesmodulesopenc
v_contribmodulesfacesrceigen_faces.cpp, line 117
terminate called after throwing an instance of 'cv::Exception'
what(): D:opencv3.3sourcesmodulesopencv_contribmodulesfacesrceigen_fa
ces.cpp:117: error: (-2) This Eigenfaces model is not computed yet. Did you call
Eigenfaces::train? in function predict
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
经过排查终于查明原因:(版本兼容性问题,api发生了变化)
不能使用3.3版本中不能使用3.2版本生成的训练模型,需重新训练
opencv3.2版本使用是save和load方法
opencv3.3版本使用是write和read方法