mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Moved feature detection scripts into their own folders and added explict frame_skip value per Ibrahim's request. Finished working on snapshot and video recording scripts for next release. ... From CMUcam4 work I learned that people will just want examples that do "X" thing. So, in general, our examples should include a simple script showing off a feature and then a more complex script that does "X" where "X" is some app that a person would want. For example, we'll get reuqests for face tracking with servos, and movement detection with servos. So, instead of answering this question a million times with an example script we'll just have examples for all kinds of things people will want. Gotta automate dealing with help support at the end of the day...
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
import pyb, sensor, image, math
|
|
sensor.reset()
|
|
sensor.set_framesize(sensor.QVGA)
|
|
sensor.set_pixformat(sensor.RGB565)
|
|
red_threshold = (0,100, 0,127, 0,127) # L A B
|
|
green_threshold = (0,100, -128,0, 0,127) # L A B
|
|
blue_threshold = (0,100, -128,127, -128,0) # L A B
|
|
while(True):
|
|
# Test red threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([red_threshold])
|
|
sum, x, y, rads = img.orientation_radians()
|
|
img.draw_keypoints([(x, y, rads)], color = (255, 0, 0), size = 20)
|
|
# Test green threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([green_threshold])
|
|
sum, x, y, rads = img.orientation_radians()
|
|
img.draw_keypoints([(x, y, rads)], color = (0, 255, 0), size = 20)
|
|
# Test blue threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([blue_threshold])
|
|
sum, x, y, rads = img.orientation_radians()
|
|
img.draw_keypoints([(x, y, rads)], color = (0, 0, 255), size = 20)
|
|
# Test not red threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([red_threshold], invert = 1)
|
|
sum, x, y, rads = img.orientation_radians()
|
|
img.draw_keypoints([(x, y, rads)], color = (255, 0, 0), size = 20)
|
|
# Test not green threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([green_threshold], invert = 1)
|
|
sum, x, y, rads = img.orientation_radians()
|
|
img.draw_keypoints([(x, y, rads)], color = (0, 255, 0), size = 20)
|
|
# Test not blue threshold
|
|
for i in range(100):
|
|
img = sensor.snapshot()
|
|
img.binary([blue_threshold], invert = 1)
|
|
sum, x, y, rads = img.orientation_radians()
|
|
img.draw_keypoints([(x, y, rads)], color = (0, 0, 255), size = 20)
|