OpenCV - 不支持的格式或格式组合错误

时间:2017-01-08 20:18:56

标签: c++ image opencv

我已经从本教程http://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html创建了该程序 我以.jpg格式添加了自己的图像。但是一个目录中的一些图像(我有3个不同的目录和不同的人物照片)可能是错误的,我不知道为什么。我收到这个错误:

OpenCV Error: Unsupported format or combination of formats (In the Fisherfaces method all input samples (training images) must be of equal size! Expected 921600 pixels, but was 1228800 pixels.) in cv::Fisherfaces::train, file C:\buildslaves64\win64_amdocl\2_4_PackSlave-win64-vc11-shared\opencv\modules\contrib\src\facerec.cpp, line 564

我使用的是来自openCV 2.4.7的VS C ++ 2012和vc11库。有人可以帮我解决这个问题吗?

Good image Bad image

1 个答案:

答案 0 :(得分:1)

我解决了这个问题。这是图像大小的错误。程序预计为921600(1280像素x 720像素),错误的图像尺寸错误。它们的大小或多或少但不相等。我将它们全部格式化为1280x720并开始工作。 所有训练图像必须具有相同的大小。