Three lights present

OpenMV related project discussion.
kbk5054
Posts: 5
Joined: Wed Oct 17, 2018 8:49 am

Three lights present

Postby kbk5054 » Wed Oct 17, 2018 1:18 pm

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
User avatar
kwagyeman
Posts: 2387
Joined: Sun May 24, 2015 2:10 pm

Re: Three lights present

Postby kwagyeman » Sun Oct 21, 2018 6:05 pm

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.
Nyamekye,
kbk5054
Posts: 5
Joined: Wed Oct 17, 2018 8:49 am

Re: Three lights present

Postby kbk5054 » Thu Oct 25, 2018 2:25 pm

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.
User avatar
kwagyeman
Posts: 2387
Joined: Sun May 24, 2015 2:10 pm

Re: Three lights present

Postby kwagyeman » Thu Oct 25, 2018 4:17 pm

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().
Nyamekye,
kbk5054
Posts: 5
Joined: Wed Oct 17, 2018 8:49 am

Re: Three lights present

Postby kbk5054 » Mon Nov 05, 2018 10:24 am

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.
User avatar
kwagyeman
Posts: 2387
Joined: Sun May 24, 2015 2:10 pm

Re: Three lights present

Postby kwagyeman » Mon Nov 05, 2018 11:08 am

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
Nyamekye,
kbk5054
Posts: 5
Joined: Wed Oct 17, 2018 8:49 am

Re: Three lights present

Postby kbk5054 » 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?
User avatar
iabdalkader
Posts: 593
Joined: Sun May 24, 2015 3:53 pm

Re: Three lights present

Postby iabdalkader » Mon Nov 05, 2018 2:33 pm

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
kbk5054
Posts: 5
Joined: Wed Oct 17, 2018 8:49 am

Re: Three lights present

Postby kbk5054 » Tue Nov 06, 2018 9:10 am

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?
User avatar
kwagyeman
Posts: 2387
Joined: Sun May 24, 2015 2:10 pm

Re: Three lights present

Postby kwagyeman » Tue Nov 06, 2018 10:44 am

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.
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests