Skip to content

Instantly share code, notes, and snippets.

@anoken
Created September 5, 2019 21:10
Show Gist options
  • Save anoken/75198313f7e432dcdfa5d8364851484f to your computer and use it in GitHub Desktop.
Save anoken/75198313f7e432dcdfa5d8364851484f to your computer and use it in GitHub Desktop.
010_camera_image_conv_filter.py
import sensor, image, lcd, time
from fpioa_manager import *
from Maix import I2S, GPIO
lcd.init()
lcd.rotation(2)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
origin = (0,0,0, 0,1,0, 0,0,0)
edge = (-1,-1,-1,-1,8,-1,-1,-1,-1)
sharp = (-1,-1,-1,-1,9,-1,-1,-1,-1)
relievo = (2,0,0,0,-1,0,0,0,-1)
fm.register(board_info.BUTTON_A, fm.fpioa.GPIO1)
but_a=GPIO(GPIO.GPIO1, GPIO.IN, GPIO.PULL_UP)
but_a_pressed = 0
but_b_pressed = 0
cnt=0
while True:
if but_a.value() == 0 and but_a_pressed == 0:
cnt=cnt+1
print("A_push")
but_a_pressed=1
if but_a.value() == 1 and but_a_pressed == 1:
print("A_release")
but_a_pressed=0
img=sensor.snapshot()
if cnt==1:
img.conv3(edge)
img.draw_string(10,60, "edge",color=(255,0,0))
elif cnt==2:
img.conv3(sharp)
img.draw_string(10,60, "sharp",color=(255,0,0))
elif cnt==3:
img.conv3(relievo)
img.draw_string(10,60, "relievo",color=(255,0,0))
else :
cnt=0
lcd.display(img)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment