颜色二值化滤镜示例
import csi
import time
csi0 = csi.CSI()
csi0.reset()
csi0.framesize(csi.QVGA)
csi0.pixformat(csi.RGB565)
csi0.snapshot(time=2000)
clock = time.clock()
red_threshold = (0, 100, 0, 127, 0, 127)
green_threshold = (0, 100, -128, 0, 0, 127)
blue_threshold = (0, 100, -128, 127, -128, 0)
while True:
for i in range(100):
clock.tick()
img = csi0.snapshot()
img.binary([red_threshold])
print(clock.fps())
for i in range(100):
clock.tick()
img = csi0.snapshot()
img.binary([green_threshold])
print(clock.fps())
for i in range(100):
clock.tick()
img = csi0.snapshot()
img.binary([blue_threshold])
print(clock.fps())
for i in range(100):
clock.tick()
img = csi0.snapshot()
img.binary([red_threshold], invert=1)
print(clock.fps())
for i in range(100):
clock.tick()
img = csi0.snapshot()
img.binary([green_threshold], invert=1)
print(clock.fps())
for i in range(100):
clock.tick()
img = csi0.snapshot()
img.binary([blue_threshold], invert=1)
print(clock.fps())