(1)布局ui界面,改变对象名称
(2)facedetection.h中代码为
#ifndef FACEDETECTION_H
#define FACEDETECTION_H
#include <QtWidgets/QMainWindow>
#include "ui_facedetection.h"
#include<QImage>
#include<QTimer>
#include<opencv2/opencv.hpp>
using namespace cv;
class facedetection : public QMainWindow
{
Q_OBJECT
public:
facedetection(QWidget *parent = 0);
~facedetection();
void detect_and_draw(IplImage* img);
private:
Ui::facedetectionClass ui;
QImage *imag;
QTimer *timer;
CvCapture *cam;
IplImage *frame;
private slots:
void openCamaraSlot();
void readFarmeSlot();
void takePhotoSlot();
void closeCamaraSlot();
void faceDetectionSlot();
};
#endif // FACEDETECTION_H