mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add negate example.
This commit is contained in:
parent
7d8ae6f9ba
commit
96fb350848
19
scripts/examples/04-Image-Filters/negative.py
Normal file
19
scripts/examples/04-Image-Filters/negative.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Negative Example
|
||||||
|
#
|
||||||
|
# This example shows off negating the image. This is not a particularly
|
||||||
|
# useful method but it can come in handy once in a while.
|
||||||
|
|
||||||
|
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(time = 2000) # Let new settings take affect.
|
||||||
|
clock = time.clock() # Tracks FPS.
|
||||||
|
|
||||||
|
while(True):
|
||||||
|
clock.tick() # Track elapsed milliseconds between snapshots().
|
||||||
|
img = sensor.snapshot().negate()
|
||||||
|
|
||||||
|
print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
|
||||||
|
# connected to your computer. The FPS should increase once disconnected.
|
||||||
Loading…
Reference in New Issue
Block a user