问题描述
I'm testing example code for sensor camera_single_show_hdmi.py.
I tried all CSI ports (CSI0-1-2), Frame size & FPS, but not getting FPS higher than 30. It always remain at 30 FPS whether any setting.
复现步骤
# Camera Example
import time, os, sys
from media.sensor import *
from media.display import *
from media.media import *
sensor = None
try:
print("camera_test")
# construct a Sensor object with default configure
sensor = Sensor(id = 1, fps = 60)
# sensor reset
sensor.reset()
# set hmirror
# sensor.set_hmirror(False)
# sensor vflip
# sensor.set_vflip(False)
# set chn0 output size, 1920x1080
sensor.set_framesize(Sensor.VGA)
# set chn0 output format
sensor.set_pixformat(Sensor.YUV420SP)
# bind sensor chn0 to display layer video 1
bind_info = sensor.bind_info()
Display.bind_layer(**bind_info, layer = Display.LAYER_VIDEO1)
# set chn1 output format
sensor.set_framesize(width = 640, height = 480, chn = CAM_CHN_ID_1)
sensor.set_pixformat(Sensor.RGB888, chn = CAM_CHN_ID_1)
# set chn2 output format
sensor.set_framesize(width = 640, height = 480, chn = CAM_CHN_ID_2)
sensor.set_pixformat(Sensor.RGB565, chn = CAM_CHN_ID_2)
# use hdmi as display output
Display.init(Display.VIRT, to_ide = True, osd_num = 2)
# init media manager
MediaManager.init()
# sensor start run
sensor.run()
while True:
os.exitpoint()
img = sensor.snapshot(chn = CAM_CHN_ID_1)
Display.show_image(img, alpha = 128)
img = sensor.snapshot(chn = CAM_CHN_ID_2)
Display.show_image(img, x = 1920 - 640, layer = Display.LAYER_OSD1)
except KeyboardInterrupt as e:
print("user stop: ", e)
except BaseException as e:
import sys
sys.print_exception(e)
finally:
# sensor stop run
if isinstance(sensor, Sensor):
sensor.stop()
# deinit display
Display.deinit()
os.exitpoint(os.EXITPOINT_ENABLE_SLEEP)
time.sleep_ms(100)
# release media buffer
MediaManager.deinit()
硬件板卡
CanMV-K230-LP4-V3.0
软件版本
CanMV_K230_V3P0_micropython_v1.4-0-g6cce59c_nncase_v2.9.0.img
其他信息
Logs:
find sensor ov5647_csi1, type 6, output 1920x1080@30
vb common pool count 6
sensor(0), mode 0, buffer_num 4, buffer_size 0