openCV检测闪烁灯 [英] openCV detect blinking lights

查看:994
本文介绍了openCV检测闪烁灯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题类似于这个:
OpenCV :检测视频Feed中的闪烁灯

my question is similar to this one: OpenCV: Detect blinking lights in a video feed

我有一个LED灯,我的相机运行速度为30fps。在每个帧,我蚂蚁知道光是否打开。类似于上一个问题,我也想得到那个点的位置。

I have a LED light, and my camera runs at 30fps. At each frame, I ant to know whether the light is on or not. Similar to the previous question I also want to get the location of that point.

我现在想知道如何使用openCV这个实例(我是新的)。如果光仅仅是一个像素,但是给定相当大的背景噪声和LED的尺寸,则如何能够检测图像中的最大光源将是容易的。我必须假设我不能在iPhone上自由设置曝光。

I now wonder how to use openCV for this instance (I am new). It would be easy if the light would just be one pixel, but given considerable background noise and the size of the LED, how can I detect the greatest light source in the image. I have to assume that I cannot set the exposure freely (on an iPhone).

我是新的图像处理,我怎么会得到它?

I am new to image processing so how would I got about it?

推荐答案

如果背景只是嘈杂,但没有改变太多,你可以背景减法:

if the background is just noisy, but does not change so much you can you backgroudn subtraction:

你有2帧,你做Frame2-Frame1,然后你应用一个阈值(阈值的值取决于LED的强度,所以你应该测试它),你设置为黑色较低的像素

you have 2 frames, and you do Frame2-Frame1, then you apply a threshold (the value of the threshold depends on the intensity of the LED so you should test it), and you set to black the pixles lower than the threshold and to white the pixels higher than the threshold.

如果您将图片转换为灰度图片,这非常容易。

this is very easy if you convert your image in a grayscale one.

应该是这样的:

cvAbsDiff(img2, img1, img2);
cvThreshold(img2, img2, (double)threshold_value, 255 (if you are using an rgb image), CV_THRESH_BINARY);

如果你的LED不亮你应该只是噪音,而如果你领导是你会期望找到一个白色的地方,你的光照亮。

if your led is off you should fine just noise, while if you led is on you will expect to find a white region where your light is illuminting.

这篇关于openCV检测闪烁灯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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