建议实时图像处理 [英] Advice for real time image processing

查看:146
本文介绍了建议实时图像处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

真的需要一些帮助和建议,因为我是新的实时图像处理。



我试图实现一个系统的算法,相机得到1000fps ,并且我需要获得所有图像中的每个像素的值,并且对于图像中的所有像素对N个图像中的像素[i] [j]的演变进行不同的计算。我有(unsigned char * ptr)我想将它们传送到GPU,并开始实现使用CUDA的算法,并将数据返回到CPU。
,但我不知道什么是实时处理的最佳选择。我的系统:CPU Intel Xeon x5660 2.8Ghz(2处理器)GPU NVIDIA Quadro 5000
的问题是,我想确保,虽然我得到1000fps,并将它们传递给GPU的处理,我如何确保我没有丢失任何数据的下一秒钟从抓手?
我需要在c ++中实现多线程吗?和OpenCV / OpenCL / CUDA中的parralel编程?
如果你有任何想法或建议,让我知道。我真的需要一些专家的实时图像处理建议。谢谢

解决方案

如你所知,OpenCV使用CUDA框架在GPU中实现其几个特性。



您可以编写自己的CUDA代码/函数来操作数据,并将其转换为OpenCV格式而没有任何问题。我演示了如何在 cuda-grayscale 上执行此操作。



请注意, OpenCV 2.3.1使用CUDA 4.0 OpenCV 2.4只能工作

$ CU


$ b

想要确保当我获得1000fps,并将其传递给GPU处理


这很可能是你不能以便像来自相机的那样快地处理帧。如果你不想丢弃任何帧,你可以忘记实时(假设你不使用令人难以置信的小图片(10x15))。



如果你真的需要使用1000 FPS,你必须实现一个缓冲机制来存储来自设备的帧。这就是我们开始谈论多线程系统的实现:您的应用程序的主线程将负责从相机抓取帧并将它们存储在缓冲区中,



有关如何实现缓冲机制的信息,请检查:



如何实现cv :: Mat对象(OpenCV)的循环缓冲区?



线程安全实现循环缓冲区



C + OpenCV:IplImage with circular buffer


really need some help and advice as I'm new with real time image processing.

I am trying to implement an algorithm for a system which the camera get 1000fps, and I need to get the value of each pixel in all images and do the different calculation on the evolution of pixel[i][j] in N number of images, for all the pixels in the images. I have the (unsigned char *ptr) I want to transfer them to the GPU and start implementing the algorithm using CUDA and return the data back to CPU. but I am not sure what would be the best option for realtime processing. my system : CPU Intel Xeon x5660 2.8Ghz(2 processors) GPU NVIDIA Quadro 5000 the problem is that I want to make sure while I am getting 1000fps and and pass them to GPU for processing, how can I make sure that I am not loosing any data for the next second comming from the grabber? Do I need to implement multi threading in c++? and parralel programming in OpenCV/OpenCL/CUDA? please if you have any idea or recommendation, let me know. I really need some expert in real time image processing advice. Thank you

解决方案

As you know, OpenCV implements several of its features in the GPU as well using the CUDA framework.

You can write your own CUDA code/functions to operate on the data and convert it to the OpenCV format without any problems. I demonstrate how to do this on cuda-grayscale. I guess this example answers most of your questions.

Note that OpenCV 2.3.1 uses CUDA 4.0, and OpenCV 2.4 only works with CUDA 4.1.

Regarding this statement:

I want to make sure while I am getting 1000fps and and pass them to GPU for processing

It's most likely that you won't be able to process the frames as fast as they come from the camera. If you don't want to drop any frames, you can forget about real-time (I'm assuming you are not working with incredibly small images (10x15)).

If you really need to work with 1000 FPS you'll have to implement a buffering mechanism to store the frames that comes from the device. And this is where we start talking about the implementation of a multithreaded system: the main thread of your application will be responsible to grab the frames from the camera and store them in a buffer, and the 2nd thread will read from the buffer and perform the processing on the frames.

For information on how to implement the buffering mechanism, check:

How to implement a circular buffer of cv::Mat objects (OpenCV)?

Thread safe implementation of circular buffer

C + OpenCV: IplImage with circular buffer

这篇关于建议实时图像处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆