-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathcamera.py
53 lines (40 loc) · 1.05 KB
/
camera.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This file is part of MaixUI
# Copyright (c) sipeed.com
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
import sys
import time
import sensor
import lcd
class obj:
is_init = False
is_dual_buff = False
def init():
sensor.reset(dual_buff=obj.is_dual_buff)
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_hmirror(1)
sensor.set_vflip(1)
sensor.run(1)
sensor.skip_frames()
def get_image():
if obj.is_init == False:
obj.init()
obj.is_init = True
return sensor.snapshot()
if __name__ == "__main__":
import KPU as kpu
import gc
kpu.memtest()
lcd.init(freq=15000000)
print('ram total : ' + str(gc.mem_free() / 1024) + ' kb')
kpu.memtest()
clock = time.clock()
while(True):
clock.tick()
lcd.display(obj.get_image())
print(clock.fps())
print('ram total : ' + str(gc.mem_free() / 1024) + ' kb')
kpu.memtest()