如何将使用Qt Paint Application绘制的图像传输到Mat openCV
How to transfer the image drawn using Qt Paint Application to Mat openCV
我已经使用Qt创建了一个绘图应用程序。现在,无论我画什么,我都需要处理图像。因此,我想将绘制的图像转移到openCV中的Mat。我该怎么做?
我写了将screnshot转移到cv::Mat
的代码片段,但我希望您理解主要想法,应该进行哪些对话。
QPixmap win = QPixmap::grabWindow(QApplication::desktop()->winId());
QImage scr = win.toImage().scaled(640,480);
QImage screen = scr.convertToFormat(QImage::Format_RGB888);
cv::Mat tmp(screen.height(),screen.width(),CV_8UC3,(uchar*)screen.bits(),screen.bytesPerLine());
cvtColor(tmp, tmp,CV_BGR2RGB);
现在cv::Mat
包含此图像。
示例:
QPixmap okno = QPixmap::grabWindow(QApplication::desktop()->winId());
QImage scr = okno.toImage().scaled(640,480);
QImage screen = scr.convertToFormat(QImage::Format_RGB888);
cv::Mat tmp(screen.height(),screen.width(),CV_8UC3,(uchar*)screen.bits(),screen.bytesPerLine());
cvtColor(tmp, tmp,CV_BGR2RGB);
cv::namedWindow("d");
cv::imshow("d",tmp);
CCD_ 3正确地显示了CCD_ 4。
相关文章:
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 如何使用OpenCV将RBG图像转换为HSV,并将H、S和V值保存为C++中的3个独立图像
- 如何将图像传输到c++(dll)中的缓冲区,然后在c#的缓冲区中读/写
- 在本地网络中通过OpenCV(C++)实时流式传输图像
- 在 OpenCV 中应用公式并传输图像
- 如何通过插座传输 ESP32-Cam 拍摄的图像?
- OpenGL?中用于渲染的平面图像的高效传输
- 使用图像传输压缩和增强库 C++
- 是否可以在图形卡上渲染场景,然后将图像传输回系统内存
- 如何将OpenCV图像推送到GStreamer管道中,以便通过TCPServer接收器进行流式传输
- 在 Windows 7 上通过 QTcpSocket 流式传输图像
- 无法将像素以正确的形状从 cv 代码传输到 cv2 代码的正确图像
- 如何在C++中从相机流式传输图像/数据
- gstreamer 管道代码,用于通过来自相机的实时流式传输而不是图像显示文本
- 将图像文件从 MFC 应用流式传输到 HTML 页面
- 像素数据传输:24BPP图像,GL_UNPACK_ALIGNENT设置为4
- 如何使用ApacheThrift将图像从Python流式传输到C++
- 如何将使用Qt Paint Application绘制的图像传输到Mat openCV
- 使用命名(fifo)管道在python和c++之间传输数组(图像)
- 如何将应用程序的图像(HBITMAP)传输到另一个应用程序