logo

为什么把QQVGA改成QVGA就提示报错,Memory Error

2019-03-07 11:53
2
towb
import sensor, image, time, pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)  #跳过2s
sensor.set_auto_gain(False)      #关掉增益
sensor.set_auto_whitebal(False)  #关掉白平衡
clock = time.clock()            #返回一个时钟对象
pyb.LED(1).on()                  #红灯亮
sensor.skip_frames(time = 5000)  #准备拍照,等待5s
pyb.LED(1).off()
pyb.LED(3).on()
print("请看镜头!")
img = sensor.snapshot().lens_corr(1.8)  #拍取一张照片
print(img)
clock.tick()
#开始追踪运行时间与后面的clock.fps()-停止追踪运行时间,并返回当前FPS,两个配合配合使用
for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,
                r_min = 2, r_max = 100, r_step = 2):
    area = (c.x()-c.r(), c.y()-c.r(), 2*c.r(), 2*c.r())
    print(area)
    #area为识别到的圆的区域,即圆的外接矩形框
    statistics = img.get_statistics(roi=area)#像素颜色统计
    print(statistics)
    #(0,100,0,120,0,120)是红色的阈值,所以当区域内的众数(也就是最多的颜色),范围在这个阈值内,就说明是红色的圆。
    #l_mode(),a_mode(),b_mode()是L通道,A通道,B通道的众数。
if 0<statistics.l_mode()<100 and 0<statistics.a_mode()<127 and 0<statistics.b_mode()<127:
    print("红色圆已找到")
else:
    print("未找到")

print("FPS%f"%clock.fps())![0_1551930734824_捕获.PNG](https://fcdn.singtown.com/1f065717-4220-443b-b27b-0607eabc0a9a.PNG)
2019-03-07 18:07
I
网红小智智 星瞳科技

https://forum.singtown.com/topic/2402/memory-error-out-of-fast-frame-buffer-stack%E6%8A%A5%E8%AD%A6%E9%97%AE%E9%A2%98

请不要重复发帖子。