Пример #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(&screenshot, SIGNAL(newImageCaptured(QPixmapSharedPtr)), this, SLOT(screenshotCaptured(QPixmapSharedPtr)));
    connect(&areaCapture, SIGNAL(newImageCaptured(QPixmapSharedPtr)), this, SLOT(screenshotCaptured(QPixmapSharedPtr)));
    connect(&imgurUploader, SIGNAL(error(QString)), this, SLOT(uploadError(QString)));
    connect(&imgurUploader, SIGNAL(imageUploaded(QUrl)), this, SLOT(fileUploaded(QUrl)));
    connect(ui->buttonScreenshot, SIGNAL(clicked()), this, SLOT(captureScreen()));
    connect(ui->buttonCaptureArea, SIGNAL(clicked()), this, SLOT(captureArea()));
    connect(&tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(show()));
    tray.show();
}
Пример #2
0
//眨眼计时器超时的slot函数
void BlinkAnalyser::timeout(){

    timeoutTimer->stop();
    QObject::disconnect(webcamCapture,SIGNAL(newImageCaptured(cv::Mat)),this,SLOT(receiveNewFrame(cv::Mat)));   //解绑接收摄像头事件
    //cv::destroyAllWindows();
    emit this->done(false);
    std::cout << "BlinkAnalyser Time out!"<<std::endl;
}
Пример #3
0
//开启检测眨眼线程
void BlinkAnalyser::start(){
    QSound::play("/home/netbeen/QtWorkspace/LivenessDetection3/请眨眼.wav");
    timeoutTimer = new QTimer();
    QObject::connect(timeoutTimer,SIGNAL(timeout()),this,SLOT(timeout()));
    std::cout << "BlinkAnalyser at " << QThread::currentThreadId()<< std::endl;
    QObject::connect(webcamCapture,SIGNAL(newImageCaptured(cv::Mat)),this,SLOT(receiveNewFrame(cv::Mat)));
    timeoutTimer->start(timeoutTimeMs);
}
void OpenMouthAnalyser::success(){

    timeoutTimer->stop();
    QObject::disconnect(webcamCapture,SIGNAL(newImageCaptured(cv::Mat)),this,SLOT(receiveNewFrame(cv::Mat)));   //解绑接收摄像头事件
    cv::destroyAllWindows();
    std::cout << "OpenMouthAnalyser success!"<<std::endl;
    emit this->done(true);
}
void OpenMouthAnalyser::start(){
    timeoutTimer = new QTimer();
    QObject::connect(timeoutTimer,SIGNAL(timeout()),this,SLOT(timeout()));      //绑定计时器事件
    std::cout << "OpenMouthAnalyser at " << QThread::currentThreadId()<< std::endl;
    QObject::connect(webcamCapture,SIGNAL(newImageCaptured(cv::Mat)),this,SLOT(receiveNewFrame(cv::Mat)));
    timeoutTimer->start(timeoutTimeMs);

}
Пример #6
0
//启动入口函数
void YawAnalyser::start(){
    std::cout << "YawAnalyser at " << QThread::currentThreadId()<< std::endl;
    QObject::connect(webcamCapture,SIGNAL(newImageCaptured(cv::Mat)),this,SLOT(receiveNewFrame(cv::Mat)));  //绑定接收摄像头事件
    isProgressTimeout=false;
    this->progressTimer = new QTimer();
    QObject::connect(this->progressTimer,SIGNAL(timeout()),this,SLOT(progressTimeout()));      //绑定计时器事件
    this->updateSliderTimer = new QTimer();
    QObject::connect(this->updateSliderTimer,SIGNAL(timeout()),this,SLOT(updateSliderTimeout()));
    this->progressTimer->start(totalProgressTimeMS);
    this->updateSliderTimer->start(totalProgressTimeMS/1000);
}
Пример #7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    webcamCapture = WebcamCapture::getInstance();
    QObject::connect(webcamCapture,SIGNAL(newImageCaptured(cv::Mat)),this,SLOT(updateImage(cv::Mat)));

    controller = Controller::getInstance();
    QObject::connect(this,SIGNAL(startToRunButtonClicked()),controller,SLOT(start()));
    QObject::connect(controller,SIGNAL(updateSlider(int)),this,SLOT(receiveSliderPercentage(int))); //从controller传来的滑块percentage

    ui->setupUi(this);
}
Пример #8
0
//摇头测试结束,开始计算结果
void YawAnalyser::finish(){
    this->progressTimer->stop();
    this->updateSliderTimer->stop();
    QObject::disconnect(webcamCapture,SIGNAL(newImageCaptured(cv::Mat)),this,SLOT(receiveNewFrame(cv::Mat)));   //解绑接收摄像头事件
    QObject::disconnect(this,SIGNAL(doCalcOpticalFlow(cv::Mat)),this->opticalFlowCalculater,SLOT(doCalc(cv::Mat)));     //解绑光流计算事件
    QObject::disconnect(opticalFlowCalculater,SIGNAL(calcCompete(bool,cv::Mat)),this,SLOT(receiveNewOpticalFlow(bool,cv::Mat)));    //解绑接受光流事件
    //cv::destroyAllWindows();
    std::cout << "YawAnalyser Time out!"<<std::endl;

    /////////////////////
    std::cout << "捕获到光流总帧数:" <<this->leftBackgroundNormalVector.size() <<std::endl;
    std::cout << "左模" << Utils::calculatePearsonCorrelation(this->faceNormalVector,this->leftBackgroundNormalVector) <<std::endl;
    std::cout << "右模"<< Utils::calculatePearsonCorrelation(this->faceNormalVector,this->rightBackgroundNormalVector) <<std::endl;
    std::cout << "左相位"<< Utils::calculatePearsonCorrelation(this->facePhaseVector,this->leftBackgroundPhaseVector) <<std::endl;
    std::cout << "右相位"<< Utils::calculatePearsonCorrelation(this->facePhaseVector,this->rightBackgroundPhaseVector) <<std::endl;

    emit this->done(true);
}