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...
18 lines
693 B
Python
18 lines
693 B
Python
# Hello World Example
|
|
#
|
|
# Welcome to the OpenMV IDE! Click on the gear button above to run the script!
|
|
|
|
import sensor, image, time
|
|
|
|
sensor.reset() # Initialize the camera sensor.
|
|
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
|
|
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
|
|
sensor.skip_frames(10) # Let new settings take affect.
|
|
clock = time.clock() # Tracks FPS.
|
|
|
|
while(True):
|
|
clock.tick() # Track elapsed milliseconds between snapshots().
|
|
img = sensor.snapshot() # Take a picture and return the image.
|
|
print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
|
|
# connected to your computer. The FPS should increase once disconnected.
|