openmv to arduino with template matching examples

Ibrahim, can you help on this?

Hi, here’s an example for pin control:

import sensor, image
from image import SEARCH_EX, SEARCH_DS
from pyb import Pin

sensor.reset()
sensor.set_contrast(1)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.QQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)

pin1 = Pin('P1', Pin.OUT_PP, Pin.PULL_DOWN)
pin1.value(0)
template = image.Image("/template.pgm")

while (True):
    img = sensor.snapshot()
    r = img.find_template(template, 0.70, step=4, search=SEARCH_EX)
    if r:
        pin1.value(1)

Thank you sir

Its working :slight_smile:

But without computer how can i use this.
I can upload program into OpenMV?

Yes, go to Tools → Save Script to OpenMV Cam.

Then after the script has been saved click the: Tools → Reset OpenMV Cam button.

Thanks for quick support. :smiley: