Three lights present

Hello,

Just as a forewarning, I don’t have much experience with programming or machine vision. But…

I am working on a project where I would like the OpenMV Cam to look at a product and tell me if there are 3 small lights present. Two of the lights should be solid and one light should be blinking at a certain rate. The lights are each a different color, and the camera will be fixed in place. I was thinking I would have to combine the find_circles example with a color tracker example, but I’m not sure.

I was hoping for any helpful tips or a point in the right direction. Any help would be greatly appreciated.

Thanks!
Kyle

Hi, just start with the color tracking examples and you’ll be fine. This is very easy to do. Use the Threshold Editor under OpenMV IDE → Tools → Machine Vision to edit the tracking colors.

If you’re having problems with the camera’s exposure see the sensor control scripts for how to control that.

Thank you for the tips! It’s working for the most part, except the camera is picking up the yellow color at the red light location. Please advise if there is an easy solution to this.

Hi, yellow and red are similar. You need to shrink the red color bounds to remove the yellow color. Note that you needn’t get rid of all pixels. Just remove enough of them and then hae object area/pixel filterting take care of the small blobs. See the pixel/area parameter on find_blobs().

Thank you, you have been extremely helpful. I do have one last question: How can I use python to run the Locate_colors.py on the OpenMV camera? I’m trying to use pyserial to open the serial, but I’m not sure how to run the specific Locate_colors.py program and acquire that output. Any tips would be greatly appreciated. Thank again.

Are you trying to control the camera from the PC? If so, please use this script:

Thank you. Are there certain parts of that script that I will have to alter to run a specified micropython script on the openmv cam?

Hi, this script is a Python module that implements the camera’s debugging protocol. It’s somewhat advanced for what you want to do.

If you just want to run a script on the camera and read back the output on your PC, see this example instead:

https://github.com/openmv/openmv/blob/master/scripts/examples/02-Board-Control/usb_vcp.py

Thank you! That example is for accessing the images from the camera though; are there examples for accessing the output that would normally be displayed in the Serial Terminal of OpenMV IDE?

These two scripts:

They really aren’t examples however so much as the original dev tools. That said, they are very straight forward to use.