Webcam RGB Calibration VI

Just finished this VI for our team…figured it would be of use to other teams. It’s somewhat similar to the CMU2 VI that has been used in past years.

All you need to do is run the VI and it will ask you to load a webcam image in.

If you have a webcam loop setup in your main project you can just send the webcam image to a display and from there you can save frames captured from the webcam. Input these images into this calibration VI and then you can get your RGB color values set dead on.

Enjoy. (222 KB) (222 KB)

That is a very useful VI. Just a few observations though.

When using a loop going through an array in LV, you don’t really need to wire the size. If you remove the 320 and 240 it will still work, and now it will work for other image sizes.

The bottom logic for pinning between 0 and 255 can also be done with a few In Range and Coerce nodes. They are used in the loop on top to tell if the color is in range, and they have another terminal of the coerced value.

Finally, now that you have this working, you may want to try using HSL color space. For your app, it would just be converting the image before you extract the array, and renaming the comparison inputs and outputs.

The examples for vision all use HSL color math because it will give you much better results, especially when the lights cause shadows or glare.

Greg McKaskle