本文介绍了使用Opencv直接从网络摄像头获取灰度图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于在我的嵌入式应用程序中,我需要灰度图像,为了节省时间,我试图直接从灰度级的网络摄像头获取帧,而无需从RGB格式转换中获取帧.

Since in my embedded application I need images in grayscale, in order to save time I'm trying to get a frame from the webcam directly in grayscale without getting it from RGB format conversion.

我找到的示例以RGB格式获取帧,然后将其转换为

The examples that I've found gets the frame in RGB and then converts it with

cvCvtColor(im_rgb,im_gray,CV_RGB2GRAY)

谢谢.

推荐答案

在Linux上,只需使用v4l2-ctl命令减少所有饱和度并让相机吐出灰度输出:

On Linux, simply use the v4l2-ctl command to reduce all saturation and get the camera to spit out grayscale output:

 v4l2-ctl -c saturation=0

当然,只有在您的摄像头支持saturation选项时,该功能才有效.要检查是否可以,请查看所有可用控件:

Of course, that will work only if your webcam supports the saturation option. To check whether it does, take a look at all available controls:

v4l2-ctl -l

这篇关于使用Opencv直接从网络摄像头获取灰度图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 22:23