void WebcamImageProcessor::processImage(ImagePtr image) { auto processedImage = image->transformed(m_rotation); image->swap(processedImage); Q_EMIT imageProcessed(image); }
WorkerAdapter::WorkerAdapter(std::shared_ptr<WorkerThread> worker_, QObject *parent) : QObject(parent), worker(worker_) { worker->statusSignal().connect( [=] (std::string message) { emit statusmsg(message); } ); worker->finishedSignal().connect( [=] (void *) { emit finished(); } ); worker->imageProcessedSignal().connect( [=] (GazeHypsPtr gazehyps) { emit imageProcessed(gazehyps); QCoreApplication::processEvents(); } ); }
void FaceDetector::processFrame() { processTime->start(); webcam.read(inputFrame); cv::cvtColor(inputFrame,outputFrame,CV_BGR2RGB); //4 nanosec cv::Size size(320,240); cv::resize(inputFrame,inputFrame,size); cv::cvtColor(inputFrame,processedFrame,CV_BGR2GRAY); //4 nanosec detect(); //60 nanosec cv::putText(outputFrame,"Frames: "+QString::number(++frames).toStdString(),cv::Point(10,50),cv::FONT_HERSHEY_COMPLEX_SMALL,0.7,cv::Scalar(0, 255, 0)); cv::putText(outputFrame,"Delay: "+QString::number(processTime->elapsed()).toStdString(),cv::Point(10,65),cv::FONT_HERSHEY_COMPLEX_SMALL,0.7,cv::Scalar(0, 255, 0)); outputImage = QImage((uchar*)outputFrame.data,outputFrame.cols,outputFrame.rows,outputFrame.step,QImage::Format_RGB888); emit imageProcessed(outputImage); }