Qt:捕获图像而不保存 - QCameraImageCapture [英] Qt: Capture image without saving - QCameraImageCapture
问题描述
我在使用OpenCV和QCamera之间的一个项目我正在工作。
I was torn between using OpenCV and QCamera for a project I'm working on.
基本上我想让用户输入他们想要捕获多少帧,然后相机将采用应用了使用CUDA和CPU实现编写的高斯滤波器的那个数量的图像。
Basically I want a user to input how many frames they want to capture, the camera will then take that amount of images applying a Gaussian filter I have written with both a CUDA and CPU implementation.
然后,数据被返回并放入图形中,所以I可以分析性能差异。
Data is then returned and put into a graph so I can analyse the performance difference.
我已经设置了大部分的应用程序,但我在最后的障碍,我创建了一个 QCameraViewFinder
, QCameraImageCapture
和 QCamera
对象。在我的while循环中,我然后调用以下代码:
I have set most of my application up, but I'm struggling at the final hurdle, I have created a QCameraViewFinder
, QCameraImageCapture
and QCamera
object. In my while loop I am then calling the following code:
do
{
imageCapture->capture();
//cpu method call here
// Emit the frame number from the thread back to GUI for update
emit frameProcessed(QString::number(currFrame));
currFrame++;
frames--;
} while(frames > 0);
如何提取 imageCapture-> capture创建的图像
不保存到我的机器?我关心的唯一数据是函数需要计算的时间(以毫秒为单位),因此不必保存原始图像数据。
How would I extract the image created by imageCapture->capture
without saving it to my machine? The only data I am concerned with is the time in ms that the functions take to compute, so saving the raw image data is not necessary.
推荐答案
-
确保缓冲区目标是支持的:
Make sure that the buffer destination is supported:
imageCapture.
isCaptureDestinationSupported(QCameraImageCapture::CaptureToBuffer)
如果是这样,请设置缓冲目标,和缓冲区格式和分辨率等。
If so, set the buffer destination, and buffer format and resolution, etc.
最后,在连接到 QVideoFrame&)
信号。
这篇关于Qt:捕获图像而不保存 - QCameraImageCapture的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!