Page 1 of 1

Three lights present

Posted: Wed Oct 17, 2018 1:18 pm
by kbk5054
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

Re: Three lights present

Posted: Sun Oct 21, 2018 6:05 pm
by kwagyeman
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.

Re: Three lights present

Posted: Thu Oct 25, 2018 2:25 pm
by kbk5054
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.

Re: Three lights present

Posted: Thu Oct 25, 2018 4:17 pm
by kwagyeman
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().

Re: Three lights present

Posted: Mon Nov 05, 2018 10:24 am
by kbk5054
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.

Re: Three lights present

Posted: Mon Nov 05, 2018 11:08 am
by kwagyeman
Are you trying to control the camera from the PC? If so, please use this script:

https://github.com/openmv/openmv/blob/m ... yopenmv.py

Re: Three lights present

Posted: Mon Nov 05, 2018 1:00 pm
by kbk5054
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?

Re: Three lights present

Posted: Mon Nov 05, 2018 2:33 pm
by iabdalkader
kbk5054 wrote:
Mon Nov 05, 2018 1:00 pm
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/m ... usb_vcp.py

Re: Three lights present

Posted: Tue Nov 06, 2018 9:10 am
by kbk5054
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?

Re: Three lights present

Posted: Tue Nov 06, 2018 10:44 am
by kwagyeman
These two scripts:

https://github.com/openmv/openmv/blob/m ... enmv_fb.py
https://github.com/openmv/openmv/blob/m ... yopenmv.py

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