gpt4 book ai didi

android - 具有 LBP 级联的 javaCV detectMultiScale 在物理设备上不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:21 26 4
gpt4 key购买 nike

我的 Android 应用程序使用 javaCV 并使用 LBP 级联调用 detectMultiScale() 函数来检测人脸。它在我的模拟器上工作得很好。然而,当我试图在我的 HTC Incredible S 上测试它时,它返回 0,无法检测到任何人脸!谁能告诉我一些提示为什么它不起作用?非常感谢您的帮助!!!

这是我的人脸检测代码:

    CASCADE_FILE = working_Dir.getAbsolutePath() + "/lbpcascade_frontalface.xml";

public static CvRect getFaceWithLBP(IplImage grayFaceImg)
{
CascadeClassifier cascade = new CascadeClassifier(CASCADE_FILE);
CvRect facesdetection = new CvRect(null);

cascade.detectMultiScale(grayFaceImg, facesdetection, 1.1, 2, CV_HAAR_FIND_BIGGEST_OBJECT | CV_HAAR_DO_ROUGH_SEARCH,
new CvSize(), new CvSize(grayFaceImg.width(), grayFaceImg.height()));

return facesdetection;
}

最佳答案

请注意,根据 the OpenCV documentation ,标志(例如 CV_HAAR_FIND_BIGGEST_OBJECT | CV_HAAR_DO_ROUGH_SEARCH)不能用于新级联(如 LBP 级联)。

void CascadeClassifier::detectMultiScale(const Mat& image, vector& objects, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size()) Parameters:

  • cascade – Haar classifier cascade (OpenCV 1.x API only). It can be loaded from XML or YAML file using Load(). When the cascade is not needed anymore, release it using cvReleaseHaarClassifierCascade(&cascade).
  • image – Matrix of the type CV_8U containing an image where objects are detected.
  • objects – Vector of rectangles where each rectangle contains the detected object.
  • scaleFactor – Parameter specifying how much the image size is reduced at each image scale.
  • minNeighbors – Parameter specifying how many neighbors each candidate rectangle should have to retain it.
  • flags – Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
  • minSize – Minimum possible object size. Objects smaller than that are ignored.
  • maxSize – Maximum possible object size. Objects larger than that are ignored.

关于android - 具有 LBP 级联的 javaCV detectMultiScale 在物理设备上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14407644/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com