Skip to content

Commit a512f1a

Browse files
committed
Merge branch 'main' into dev
2 parents 35d4510 + 0d019e7 commit a512f1a

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from maix import camera, display, app, time, uvc
2+
import time
3+
import atexit
4+
5+
cam = camera.Camera(640, 360, fps=60) # Manually set resolution
6+
# | 手动设置分辨率
7+
# disp = display.Display() # MaixCAM default is 522x368
8+
# | MaixCAM 默认是 522x368
9+
def fill_mjpg_img_cb(buf, size):
10+
img = cam.read()
11+
return uvc.helper_fill_mjpg_image(buf, size, img)
12+
13+
uvcs = uvc.UvcServer(fill_mjpg_img_cb)
14+
15+
uvcs.run()
16+
17+
while not app.need_exit():
18+
time.sleep(1)
19+
20+
# fixme: actually can't reach here, :(
21+
# uvcs.stop()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from maix import camera, display, app, time, uvc
2+
3+
cam = camera.Camera(640, 360, fps=60) # Manually set resolution
4+
# | 手动设置分辨率
5+
# disp = display.Display() # MaixCAM default is 522x368
6+
# | MaixCAM 默认是 522x368
7+
8+
uvcs = uvc.UvcStreamer()
9+
uvcs.use_mjpg(1)
10+
11+
while not app.need_exit():
12+
# time.fps_start() # Manually set fps calculation start point, comment here mean last time fps() call is start
13+
# | 动设置帧率(FPS)计算开始点,这里注释了表示上一次 fps 函数即是开始
14+
img = cam.read() # Get one frame from camera, img is maix.image.Image type object
15+
# | 从摄像头获取一帧图像,img 是 maix.image.Image 类型的对象
16+
# disp.show(img) # Show image to screen
17+
# | 将图像显示到屏幕
18+
uvcs.show(img)
19+
20+
fps = time.fps() # Calculate FPS between last time fps() call and this time call.
21+
# | 计算两次 fps 函数调用之间的帧率
22+
print(f"time: {1000/fps:.02f}ms, fps: {fps:.02f}") # print FPS in console
23+
# | 在终端打印帧率(FPS)
24+

tools/os/gen_os.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ cp -r "tmp/sys_builtin_files/boot/boards" "tmp/sys_builtin_files/maixapp/"
148148
./update_img.sh tmp/sys_builtin_files "tmp/$os_version_str.img"
149149

150150
# 9. xz 压缩镜像
151-
xz -zv "tmp/$os_version_str.img"
151+
xz -zv -T 0 "tmp/$os_version_str.img"
152152

153153
echo "Complete: os file: tmp/$os_version_str.img.xz"
154154

tools/os/update_img.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22

33
set -e
4+
set -o pipefail
45

56
source_dir=$1
67
img_file=$2
@@ -34,7 +35,9 @@ $THISDIR/fuse2fs -o fakeroot -o offset=$PART_OFFSET $img_file $mount_root
3435

3536
# copy root files
3637
echo "copy root files now"
37-
find $source_dir -mindepth 1 -maxdepth 1 -type d ! -name "boot" -exec cp -r {} $mount_root \;
38+
find $source_dir -mindepth 1 -maxdepth 1 -type d ! -name "boot" | while read -r dir; do
39+
cp -r "$dir" "$mount_root"
40+
done
3841
sync
3942
echo "copy root files done"
4043

0 commit comments

Comments
 (0)