c++ - Face Detection Using OCL (OPENCV) -


i trying detect faces using below code making use of gpu

#include <opencv\cv.h> #include <opencv\highgui.h>  #include <iostream> #include <stdio.h> #include <opencv2\ocl\ocl.hpp>  std::string face_cascade = "c:\\opencv\\data\\haarcascades\\haarcascade_frontalface_alt.xml";  std::vector<cv::rect> detectfaces(cv::mat gray){      cv::ocl::oclmat oclgray;     std::vector<cv::rect> faces;     cv::ocl::oclcascadeclassifier face_detector;      oclgray.upload(gray);     face_detector.load(face_cascade);      face_detector.detectmultiscale(oclgray, faces,  1.1, 3, 0|cv_haar_scale_image, cv::size(30, 30), cv::size(0, 0));     return faces; }  int main(){      cv::videocapture webcam;     cv::mat mainimage;     std::vector<cv::rect> faces;      webcam.open(0);     cv::namedwindow("face",cv_window_autosize);      while(webcam.isopened()){         webcam.read(mainimage);         if(!mainimage.empty()){             cv::resize(mainimage,mainimage,cv::size(640,480),0,0,1);             cv::mat gray(mainimage);             cv::cvtcolor(gray,gray,cv_bgr2gray);             cv::equalizehist(gray,gray);             faces = detectfaces(gray);              for(unsigned int i=0;i<faces.size();i++){                 cv::rect f_rect = faces[i];                 cv::rectangle(mainimage,f_rect,cv_rgb(255,0,0),1,8,0);             }             cv::imshow("face",mainimage);         }         cv::waitkey(40);     }     return 0; } 

i wasnt satisfied t speed of normal cascade classifier , coded ocl based classifier. program gets started shows error message:

enter image description here

i have installed app sdk v 2.9.1 using visual studio 2012 express edition, opencv 2.4.10 did go wrong??

thanks

edit>>

cv::ocl::oclmat oclgray;  oclgray.upload(gray); 

the above code causing error..

it looks fails on line face_detector.load(face_cascade); (use debugger make sure i'm right). make sure path correct , format of cascade file valid, may try use different cascade , of course make sure ocl installed , configured correctly.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -