We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`# Camera Example
from media.camera import * from media.display import * from media.media import * import time, os import sys def camera_test(): print("camera_test") # use hdmi for display display.init(LT9611_1920X1080_30FPS) camera.sensor_init(CAM_DEV_ID_0, CAM_DEFAULT_SENSOR) out_width = 640 out_height = 480 # set camera out width align up with 16Bytes out_width = ALIGN_UP(out_width, 16) # set chn0 output size camera.set_outsize(CAM_DEV_ID_0, CAM_CHN_ID_0, out_width, out_height) # set chn0 out format camera.set_outfmt(CAM_DEV_ID_0, CAM_CHN_ID_0, PIXEL_FORMAT_YUV_SEMIPLANAR_420) # create meida source device meida_source = media_device(CAMERA_MOD_ID, CAM_DEV_ID_0, CAM_CHN_ID_0) # create meida sink device meida_sink = media_device(DISPLAY_MOD_ID, DISPLAY_DEV_ID, DISPLAY_CHN_VIDEO1) # create meida link media.create_link(meida_source, meida_sink) # set display plane with video channel display.set_plane(0, 0, out_width, out_height, PIXEL_FORMAT_YVU_PLANAR_420, DISPLAY_MIRROR_NONE, DISPLAY_CHN_VIDEO1) # init meida buffer media.buffer_init() # start stream for camera device0 camera.start_stream(CAM_DEV_ID_0) counts = 0 # try: while True: os.exitpoint() img = camera.capture_image(CAM_DEV_ID_0, CAM_CHN_ID_0) img.compress_for_ide() # release image for dev and chn camera.release_image(CAM_DEV_ID_0, CAM_CHN_ID_0, img) counts += 1 # if counts == 40: # break # except KeyboardInterrupt as e: print("user stop: ", e) except BaseException as e: sys.print_exception(e) # stop stream for camera device0 camera.stop_stream(CAM_DEV_ID_0) # deinit display display.deinit() # destroy media link media.destroy_link(meida_source, meida_sink) os.exitpoint(os.EXITPOINT_ENABLE_SLEEP) time.sleep_ms(100) # deinit media buffer media.buffer_deinit() if name == "main": os.exitpoint(os.EXITPOINT_ENABLE) camera_test() camera_test() #`
以上代码是我在示例1的基础上加了两句代码,加的代码后面用#号标注。我就是想知道为什么我试图运行多次自定义的函数时会报错。固件版本为[CanMV-K230_micropython_v0.6_sdk_v1.5_nncase_v2.8.1.img.gz],原示例1可以正常运行
The text was updated successfully, but these errors were encountered:
你好,API有所改动,请使用最新的镜像和文档。 https://developer.canaan-creative.com/resource https://developer.canaan-creative.com/k230_canmv/main/index.html
Sorry, something went wrong.
你好,请使用最新版本的固件,v1.2.1,目前已经修复在使用sensor和display出现该问题的情况。
wuwentao
zhangxiaojingCAN
No branches or pull requests
Other
`# Camera Example
from media.camera import *
from media.display import *
from media.media import *
import time, os
import sys
def camera_test():
print("camera_test")
# use hdmi for display
display.init(LT9611_1920X1080_30FPS)
camera.sensor_init(CAM_DEV_ID_0, CAM_DEFAULT_SENSOR)
out_width = 640
out_height = 480
# set camera out width align up with 16Bytes
out_width = ALIGN_UP(out_width, 16)
# set chn0 output size
camera.set_outsize(CAM_DEV_ID_0, CAM_CHN_ID_0, out_width, out_height)
# set chn0 out format
camera.set_outfmt(CAM_DEV_ID_0, CAM_CHN_ID_0, PIXEL_FORMAT_YUV_SEMIPLANAR_420)
# create meida source device
meida_source = media_device(CAMERA_MOD_ID, CAM_DEV_ID_0, CAM_CHN_ID_0)
# create meida sink device
meida_sink = media_device(DISPLAY_MOD_ID, DISPLAY_DEV_ID, DISPLAY_CHN_VIDEO1)
# create meida link
media.create_link(meida_source, meida_sink)
# set display plane with video channel
display.set_plane(0, 0, out_width, out_height, PIXEL_FORMAT_YVU_PLANAR_420, DISPLAY_MIRROR_NONE, DISPLAY_CHN_VIDEO1)
# init meida buffer
media.buffer_init()
# start stream for camera device0
camera.start_stream(CAM_DEV_ID_0)
counts = 0 #
try:
while True:
os.exitpoint()
img = camera.capture_image(CAM_DEV_ID_0, CAM_CHN_ID_0)
img.compress_for_ide()
# release image for dev and chn
camera.release_image(CAM_DEV_ID_0, CAM_CHN_ID_0, img)
counts += 1 #
if counts == 40: #
break #
except KeyboardInterrupt as e:
print("user stop: ", e)
except BaseException as e:
sys.print_exception(e)
# stop stream for camera device0
camera.stop_stream(CAM_DEV_ID_0)
# deinit display
display.deinit()
# destroy media link
media.destroy_link(meida_source, meida_sink)
os.exitpoint(os.EXITPOINT_ENABLE_SLEEP)
time.sleep_ms(100)
# deinit media buffer
media.buffer_deinit()
if name == "main":
os.exitpoint(os.EXITPOINT_ENABLE)
camera_test()
camera_test() #`
以上代码是我在示例1的基础上加了两句代码,加的代码后面用#号标注。我就是想知道为什么我试图运行多次自定义的函数时会报错。固件版本为[CanMV-K230_micropython_v0.6_sdk_v1.5_nncase_v2.8.1.img.gz],原示例1可以正常运行
The text was updated successfully, but these errors were encountered: