void TransferTabController::beginTransfer() { Mat frame, rgb_frame, copyFrame; int counter = 0; if(show3D == true) { targetLabel->setVisible(false); face_widget->setVisible(true); } view->setAllTransferTabButtonsDisabled(true); /**********************/ /*first collect frames*/ /**********************/ s_frameData.push_back(srcFrames[srcFrames.size()-1]); sourceLabel->setPixmap(Utility::mat2QPixmap(s_frameData[0])); while( capSrc->grab() == true) { capSrc->retrieve(frame); cvtColor(frame, rgb_frame, CV_BGR2RGB); copyFrame = rgb_frame.clone(); s_frameData.push_back(copyFrame); counter++; } if(counter < frame_num) frame_num = counter; src_videoProcessor = new VideoProcessor(sourceLabel->getMarked(),s_frameData, cameraSrc, lensDist,opttype, regParam,idconstype,projtype,frame_num,iter_num,withFirstFrame, gen_point_num); connect(src_videoProcessor,SIGNAL(finished()),this,SLOT(processingFinished())); src_videoProcessor->start(); /**** now repeat the process for the other face ***/ counter = 0; t_frameData.push_back(targetFrames[targetFrames.size()-1]); targetLabel->setPixmap(Utility::mat2QPixmap(t_frameData[0])); while( capTarget->grab() == true) { capTarget->retrieve(frame); cvtColor(frame, rgb_frame, CV_BGR2RGB); copyFrame = rgb_frame.clone(); t_frameData.push_back(copyFrame); counter++; } if(counter < frame_num) frame_num = counter; target_videoProcessor = new VideoProcessor(targetLabel->getMarked(),t_frameData, cameraSrc, lensDist,opttype, regParam,idconstype,projtype,frame_num,iter_num,withFirstFrame, gen_point_num); connect(target_videoProcessor,SIGNAL(finished()),this,SLOT(processingFinished())); target_videoProcessor->start(); }
void MainWindow::setupConnections() { // connect signals for menu actions connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveClicked())); connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(loadClicked())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionShowTable, SIGNAL(triggered()), _pointsWidget, SLOT(show())); // connect signals to control calculation process (start, stop, pause, processed, ...) connect(this, SIGNAL(startProcessing()), _plotBuilder, SLOT(start())); connect(ui->stopButton, SIGNAL(clicked()), _plotBuilder, SLOT(stop())); connect(this, SIGNAL(pauseProcessing()), _plotBuilder, SLOT(pause())); connect(this, SIGNAL(resumeProcessing()), _plotBuilder, SLOT(resume())); // connect signals to intercept and display calculation results connect(_plotBuilder, SIGNAL(finished()), this, SLOT(processingFinished())); connect(_plotBuilder, SIGNAL(processed(double, double, double)), this, SLOT(valueProcessed(double, double, double))); // connect signals to populate or clear points collection connect(_plotBuilder, SIGNAL(processed(double, double, double)), _points, SLOT(addPoint(double, double))); connect(_plotBuilder, SIGNAL(started()), _points, SLOT(clear())); // connect signals to update widget that displays points collection connect(this, SIGNAL(startProcessing()), _pointsWidget, SLOT(updatePage())); connect(this, SIGNAL(pauseProcessing()), _pointsWidget, SLOT(updatePage())); connect(_plotBuilder, SIGNAL(finished()), _pointsWidget, SLOT(updatePage())); }
void CodeReaderThread::run() { m_mutex.lock(); QImage processingImage = QImage(m_image); m_mutex.unlock(); while (!m_quit) { // Image Processing: searching for codes QString code = processImage(processingImage); m_mutex.lock(); QImage image; if (!code.isEmpty()) image = processingImage.copy(); // Notify that the image processing is done emit processingFinished(image, code); m_condition.wait(&m_mutex); processingImage = QImage(m_image); m_mutex.unlock(); } }