我有一个工作线程(QT c ++),它从也有一行代码的摄像机获取视频输入。
WorkerThread
inRange(HSV, cv::Scalar(HMin, SMin, VMin), cv::Scalar(HMax, SMax, VMax), threshold);
emitt mainThread_DisplayThreshold(threshold);
在MainThread
{
ui->graphicsView_2->setScene(new QGraphicsScene(this));
ui->graphicsView_2->scene()->addItem(&hsvpix);
}
void MainWindow::mainThread_DisplayThreshold(cv::Mat Threshold)
{
cv::imshow("Theshold Image",Thresshold); this will work as usual
//this is wrong ?? nothing display but only white
QPixmap p = QPixmap::fromImage(QImage(Threshold.data, Threshold.cols, Threshold.rows, Threshold.step, QImage::Format_RGB888).rgbSwapped());
ThressPix.setPixmap(p);
ui->graphicsView_2->fitInView(&ThressPix);}
我可以显示视频源,但不能显示阈值图像
如何在Qt小部件(例如QLabel或QGraphicView)上显示阈值图像?
谢谢