Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Initialize OpenCL runtime... Error

Hi there, I am a new member to the forum. I have setup OpenCV with homebrew on mac os x yosemite. My all programs are running except image detection. But this simple program is giving me error runtime.

Explanation : I am detecting faces with Opencv with c++ . Running like :- Apples-MacBook:detect_object rushi$ g++ objectDetection.cpp -o out pkg-config --cflags --libs opencv Apples-MacBook:detect_object rushi$ ./out [ INFO:0] Initialize OpenCL runtime...

Below is my source code -

#include <opencv2/core/core.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <stdio.h>
#include <iostream>

using namespace cv;
using namespace std;


int main(void)
{
Mat image;
image = imread( "./actress.jpeg", 1 );

if( !image.data )
{
printf( " No image data \n " );
return -1;
}

String face_cascade_file = "./haarcascade_frontalface_alt.xml";
CascadeClassifier FaceCascadeClassifier;

// Load the cascade

if (!FaceCascadeClassifier.load(face_cascade_file))
{
printf("--(!)Error loading cascde classifier...\n");
return (-1);
}

vector<Rect> faces;
FaceCascadeClassifier.detectMultiScale(image, faces, 1.1, 3, CV_HAAR_FIND_BIGGEST_OBJECT, Size(30, 30), Size(200,200));

cout<<"faces" <<faces.size();

waitKey(0);
return 0;
}