Detect Multiple LEDs and their flashing frequency

asked 2015-06-06 02:16:30 -0500

Prem gravatar image

updated 2015-06-11 02:03:33 -0500

C:\fakepath\code.pngimage descriptionimage description(/upfiles/14337421785288362.jpg)Hi All,

I am new to openCV. I am trying to detect the position and frequency of multiple LEDs using OpenCV. Kindly guide me how can I achieve the same? I couldn't use the HSV conversion method because there may be other lights brighter than LED as well. Here is the basic logic. 1. LEDs are flashing at predefined rate. My camera has been set to 90 fps and the LEDs have frequency of 90Hz, 45Hz, 30Hz and 15Hz ( these frequencies and camera frame rate are known parameters ) 2. Now I need to find the location of these lights within camera frame in any lightning condition. Be it night where the light is the brightest in the room or be it sunlight where it may not be the brightest object in the scene.

I would appreciate the help.

edit retag flag offensive close merge delete

Comments

1

are the LEDS colorful or not? if yes then color segmentation I think should be your first try...

theodore gravatar imagetheodore ( 2015-06-06 08:16:39 -0500 )edit

Is the camera synchronized with the LEDs?

FooBar gravatar imageFooBar ( 2015-06-06 11:39:37 -0500 )edit
1

You like Shannon. How long led are flashing ? what is time integration of your camera?

LBerger gravatar imageLBerger ( 2015-06-06 16:04:15 -0500 )edit

@theodore: the LEDs are all white, I tried color segmentation and was just able to detect the position of LEDs in an environment where there are no other illuminations that have same or more brightness than LEDs. With my limited programming skills I was not able to find a logic to detect frequency in this controlled environment as well. I need this to work in any environment. @FooBar Though the camera is not synchronized with the LEDs, Camera fps has been set as multiple of LED frequency. As stated in my question camera frame rate is 90fps and LED frequency has been set as 90, 45, 30 and 15 hz. @LBerger LEDs will be flashing indefinitely. I would like to detect LED positions and frequency as efficiently as possible ( processing wise and time wise ) after the camera is focused on the LEDs.

Prem gravatar imagePrem ( 2015-06-06 20:34:53 -0500 )edit

@LBerger pardon my ignorance, i couldn't find time integration of my camera model in it's data sheet. This is my camera http://www.ptgrey.com/grasshopper3-41...

Prem gravatar imagePrem ( 2015-06-07 01:43:09 -0500 )edit

So my english is bad it was exposure time p46 If your FPS is 90Hz and your led flash at frequency F then there is no problem with 15 and 30 hz you will see a spot for 15 hz3 images on and three images off for 30Hz 1 images on and two images off (or 2 and 1) and for 45Hz I don't know like 90Hz may be sometime 90 images on and 90 images off. You cannot detect your LED in 1 second you need time and its depends of image context

LBerger gravatar imageLBerger ( 2015-06-07 03:17:32 -0500 )edit
1

@Prem, do you have control on the signal that is attached to the LED? Because simply grabbing that signal and looking for its edges can be way more efficient and far more correct than simply using computer vision for this. As to the detection of the LEDS, the most applied technique in machine vision is to add a filter before your camera lens, which has a band pass filter around the frequency of your LED. This will remove about all other signals. This is again far more effective and robust than simply using segmentation techniques like you experienced yourself.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-07 04:11:36 -0500 )edit

@LBerger I have control over frequency of LED so the frequency is not an issue. I can bring down (or change) the frequency so that the LED with maximum frequency has one image on and one image off. You mentioned exactly what I want to achieve. Here is what i thought, 1st LED has one image on, one image off, 2nd LED has two image on and two image off, 3rd LED has three image on and 3 image off and the 4th LED has four image on and four image off. I am planning to capture say 20 images and check for the pattern and spot four LEDs. My problem is I lack the OpenCV knowledge to do so. Can you please guide me how can I achieve this?

Prem gravatar imagePrem ( 2015-06-07 09:13:48 -0500 )edit

@StevenPuttemans thanks a lot for the insight. As you pointed out band pass filter attached to the camera would be the most efficient way to achieve this. Unfortunately I am not allowed to use the hardware band pass filter so I need software band pass filter implementation in OpenCV to locate and calculate frequency of these LEDs.

Prem gravatar imagePrem ( 2015-06-07 09:22:59 -0500 )edit

Can you click at led position at begining of your process ? if yes it's not image processing but pixel processing. If you don't know position may be you can start with threshold difference of two frames. it can work if nothing is moving in your video. if something is moving then you should post two images...

LBerger gravatar imageLBerger ( 2015-06-07 09:35:49 -0500 )edit