-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from taorye/main
feat: example for uvc_server and uvc_stream
- Loading branch information
Showing
2 changed files
with
23 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from maix import camera, display, app, time, uvc | ||
import time | ||
import atexit | ||
|
||
cam = camera.Camera(640, 360, fps=60) # Manually set resolution | ||
# | 手动设置分辨率 | ||
# disp = display.Display() # MaixCAM default is 522x368 | ||
# | MaixCAM 默认是 522x368 | ||
def fill_mjpg_img_cb(buf, size): | ||
img = cam.read() | ||
return uvc.helper_fill_mjpg_image(buf, size, img) | ||
|
||
uvcs = uvc.UvcServer(fill_mjpg_img_cb) | ||
|
||
uvcs.run() | ||
|
||
while not app.need_exit(): | ||
time.sleep(1) | ||
|
||
# fixme: actually can't reach here, :( | ||
# uvcs.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters