const char *filename="C://OpenCV2.2//data//haarcascades//haarcascade_frontalface_alt.xml";
cascade = ( CvHaarClassifierCascade* )cvLoad(filename,0,0,0);
if( !cascade )
{
fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
return -1;
}
storage=cvCreateMemStorage(0);
capture=cvCaptureFromCAM(0);
// assert( cascade && storage && capture );
IplImage* frame= cvQueryFrame(capture);
ui->frame->setMinimumSize(m_i.width(),m_i.height());
ui->frame->setMaximumSize(ui->frame->minimumSize());
m_opencvimg=cvCreateImageHeader(cvSize(m_i.width(),m_i.height()),8,3);
m_opencvimg->imageData=(char*)m_i.bits();
if(frame->origin== IPL_ORIGIN_TL)
cvCopy(frame,m_opencvimg,0);
else
cvFlip(frame,m_opencvimg,0);
cvCvtColor(m_opencvimg,m_opencvimg,CV_BGR2RGB);
connect(m_timer,SIGNAL(timeout()),this,SLOT(queryFrame()));
m_timer->start(50);
const char *filename="C://OpenCV2.2//data//haarcascades//haarcascade_frontalface_alt.xml";
cascade = ( CvHaarClassifierCascade* )cvLoad(filename,0,0,0);
if( !cascade )
{
fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
return -1;
}
storage=cvCreateMemStorage(0);
capture=cvCaptureFromCAM(0);
// assert( cascade && storage && capture );
IplImage* frame= cvQueryFrame(capture);
m_i=QImage(QSize(frame->width,frame->height),QImage::Format_RGB888);
ui->frame->setMinimumSize(m_i.width(),m_i.height());
ui->frame->setMaximumSize(ui->frame->minimumSize());
m_opencvimg=cvCreateImageHeader(cvSize(m_i.width(),m_i.height()),8,3);
m_opencvimg->imageData=(char*)m_i.bits();
if(frame->origin== IPL_ORIGIN_TL)
cvCopy(frame,m_opencvimg,0);
else
cvFlip(frame,m_opencvimg,0);
cvCvtColor(m_opencvimg,m_opencvimg,CV_BGR2RGB);
m_timer=new QTimer(this);
connect(m_timer,SIGNAL(timeout()),this,SLOT(queryFrame()));
m_timer->start(50);
To copy to clipboard, switch view to plain text mode
Bookmarks