MemoryError报错提示

Viewed 9

问题描述


代码中到灰度,565,888,p888几种格式的图片可能都会用到,直接采集比来回转换快一些,所以设置了通道0采集灰度,1采集888,2采集p888,

if ch_cfg["grey"]["able"]: img_gray = sensor.cus_cap(0)
if ch_cfg["rgb"]["able"]: img_888 = sensor.cus_cap(1)
if ch_cfg["rgbp"]["able"]: img_p888 = sensor.cus_cap(2)
# 显示图层赋值
if cfg.cfg_data["display"]["type"] == "Sen_GRAYSCALE" and img_gray:
    display_img = img_gray.copy()
elif cfg.cfg_data["display"]["type"] == "Sen_RGB888" and img_888:
    display_img = img_888.copy()

现有需要使用565格式所以用了函数:

img_565 = img_888.to_rgb565()
            lines = img_565.find_line_segments(merge_distance = 0, max_theta_diff = 5)
            for l in  lines:
                display_img.draw_line(l.line(), color = (255, 0, 0), thickness=2)
                print(l)

未加入这段代码时运行正常,现发生了报错:

MemoryError: Out of fast frame buffer stack memory,
是因为我存储的图像变量太多了吗,
运行时最开始打印的vb common pool count 6是什么,

硬件板卡


庐山派

软件版本


CanMV v1.4-2-g873d625(based on Micropython e00a144) on 2025-09-12; k230_canmv_lckfb with K230

我用1280,720大小的画面就会卡住,改为720,405就好了,设备能够存储的图片大小和数量有比较直观的数值吗

0 Answers