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

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

问题描述

我的问题与此类似:OpenCV:检测视频源中闪烁的灯光

我有一个 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 关闭,您应该只听到噪音,而如果您打开 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天全站免登陆