Перейти к содержимому
Compvision.ru

qwerty_nor

Пользователи
  • Количество публикаций

    2
  • Зарегистрирован

  • Посещение

  • Days Won

    2

qwerty_nor last won the day on November 21 2011

qwerty_nor had the most liked content!

Репутация

2 Новичек

О qwerty_nor

  • Звание
    Новичок
  1. Распознавание лиц

    На данный момент поддерживается 2 типа классификаторов (Хаара и LBP). LBP работает быстрее. Вот код для тестирования: facedetect.h #ifndef FACEDETECT_H #define FACEDETECT_H #include <cv.h> /*\brief Providing static function for testing face detection algoritms */ class FaceDetect { public: enum { HAAR=0, LBP=1 } featureTypes; static cv::vector<cv::Rect> detectFaces(cv::Mat input, int featureType=HAAR); }; #endif /*FACEDETECT_H */ facedetect.cpp #include <stdio.h> #include "FaceDetect.h" using namespace cv; /** * \brief Function for detecting faces * @param input_img - Matrix of the type CV_8U containing an image where faces are detected. * @param feature_type=HAAR - feature type (HAAR or LBP for now). * @return - Vector of rectangles where each rectangle contains the detected object. * * \note Use LBP Classifier witch is much faster than HAAR * */ vector<Rect>FaceDetect::detectFaces(Mat input, int featureType) { CascadeClassifier cascad; if(feature_type==LBP) cascad.load("storage/lbpcascade_frontalface.xml"); else cascad.load("storage/haarcascade_frontalface_alt2.xml"); vector<Rect> result; double t = (double)getTickCount(); cascad.detectMultiScale(input,result, 1.2, 3, CV_HAAR_DO_CANNY_PRUNING|CV_HAAR_SCALE_IMAGE| CV_HAAR_DO_ROUGH_SEARCH, Size(40,40)); //you can play with options here t = ((double)getTickCount() - t)/getTickFrequency(); printf("Speed = %f \n Accuracy = %d", t, result.size()); return result; } main.cpp #include "cv.h" #include "highgui.h" #include "FaceDetect.h" using namespace cv; int main(int, char**) { Mat img; img = imread("photo_with_many_faces.jpg", 1); vector<Rect> result1 =FaceDetect::detectFaces(img, FaceDetect::HAAR); vector<Rect> result2 = FaceDetect::detectFaces(img, FaceDetect::LBP); waitKey(0); return 0; }
  2. Распознавание лиц

    Посмотри здесь: http://code.google.com/p/facerec/ Но все таки сравнивать нужно АЛГОРИТМЫ, т.е. не привязываясь к конкретной библиотеке компьютерного зрения.
×