mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Pixels, centroid, and orientation are calculated in the blob code now. As for threshold, it is no longer needed (plus, it required storing a secondary image in RAM which isn't really something we can handle).
24 lines
693 B
Python
24 lines
693 B
Python
import pyb, sensor, image, math
|
|
sensor.reset()
|
|
sensor.set_framesize(sensor.QVGA)
|
|
sensor.set_pixformat(sensor.GRAYSCALE)
|
|
low_threshold = (0, 50)
|
|
high_threshold = (205, 255)
|
|
while(True):
|
|
# Test low threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([low_threshold])
|
|
# Test high threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([high_threshold])
|
|
# Test not low threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([low_threshold], invert = 1)
|
|
# Test not high threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([high_threshold], invert = 1)
|