【发布时间】:2019-09-17 05:00:21
【问题描述】:
我在 opencv/c++ 中使用延迟摄像头设置人脸检测。我怎样才能做到不出错?
我使用 CascadeClassifier.Detectmultiscale 进行检测。
void detectAndDraw(Mat& img, CascadeClassifier& cascade,
double scale)
{
vector<Rect> faces;
Mat gray;
cvtColor(img, gray, COLOR_BGR2GRAY); // Convert to Gray Scale
// Resize the Grayscale Image
equalizeHist(gray, gray);
// Detect faces of different sizes using cascade classifier
cascade.detectMultiScale(gray, faces);
// Draw circles around the faces
for(int i = 0; i<=faces.size();i++){
//and cout of x,y,width,height
}
我已经解释了详细信息,但在算法中访问读取内存时出现错误。
照片:
【问题讨论】:
-
mc您遇到了什么错误?请发布minimal reproducible example 重现问题。
-
如果可以选择,请始终使用文本,因为它更具可读性、可进一步处理、一般可访问。
标签: c++ opencv face-detection