Lighting for computer vision automisation Currently I am working on a computer vision project where we want to gather data from a composite material production environment.

I have an example picture here:


What I learned so far that my lighting is not good. It's coming from a fluorescent lamp from that's right above the camera. Apparently I would have to diffuse the light with some sort of material. The reflections of the light are not doing us well.

The red and blue tape was placed there as a test to see if I can segment the image, remove the rest of the image outside of the tape. So that way I can analyse the area inside the tape. I got that working by converting the image to 8 bit and drawing a thick black line and then make a bounding box around that. But with the tape it's not working, presumably due to the reflection. The best outcome would be that the tape is recognized as somewhere between values 0-10. 

Basically what I did here:





How can I recreate this in the first image I showed?
What I learned so far that my lighting is not good. It's coming from a fluorescent lamp from that's right above the camera. Apparently I would have to diffuse the light with some sort of material. The reflections of the light are not doing us well.


A "Ring Light" type of light will cast uniform light and minimal shadows to your object. It is used regularly in photography. The link to the product is for demonstration, not to suggest that specific product.

Of course, the other thing with the ring light is that the camera shoots through the ring and it's not casting shadows.

Using diffusers is not efficient for relatively large distances (a few meters), or rather, using a diffuser means that you have to use a much stronger light behind the diffuser to flood a large area.

Now, once the light is flooding the area uniformly, place a sample tape rectangle and extract the Red, Green, Blue (RGB) values of the pixels occupied by the tape. To determine your threshold do a histogram on the RGB channels and try to characterise the modes on the R and the B channel. 

A more involved way of doing this is to scan the image once and convert the RGB values to Hue Saturation Value (HSV). You can then do one histogram on the H channel which will have two modes, one on the angle that corresponds to Red and one on the angle that corresponds to Blue. Consequently, you now have one variable (H) with two thresholds and two deviations around the thresholds.

Hope this helps.