openCV detect blinking lights

后端 未结 2 1299
独厮守ぢ
独厮守ぢ 2020-12-29 12:14

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

I have a LED light, and my camera runs at 30fps. At each frame, I ant to know whet

2条回答
  •  时光说笑
    2020-12-29 12:56

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

    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.

    should be somenthign like this:

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

    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.

提交回复
热议问题