logo

MemoryError:Out of fast Frame Buffer Stack Memory!

2019-09-10 20:42
7
我超甜
import sensor, image, time

sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # use RGB565.
sensor.set_framesize(sensor.QQVGA) # use QVGA for quailtiy ,use QQVGA for speed.
sensor.skip_frames(10) # Let new settings take affect.
sensor.set_auto_whitebal(False)
#关闭白平衡。白平衡是默认开启的,在颜色识别中,需要关闭白平衡。
clock = time.clock() # Tracks FPS.

weed_threshold_01 = ((31, 100, -128, -12, 0, 127))
'''
  扩宽roi
'''
def expand_roi(roi):
    # set for QQVGA 160*120
    extra = 5
    win_size = (160, 120)
    (x, y, width, height) = roi
    new_roi = [x-extra, y-extra, width+2*extra, height+2*extra]

    if new_roi[0] < 0:
        new_roi[0] = 0
    if new_roi[1] < 0:
        new_roi[1] = 0
    if new_roi[2] > win_size[0]:
        new_roi[2] = win_size[0]
    if new_roi[3] > win_size[1]:
        new_roi[3] = win_size[1]

    return tuple(new_roi)

while(True):
    clock.tick()
    img = sensor.snapshot()

    blobs = img.find_blobs([weed_threshold_01], area_threshold=150)
    if blobs:
    #如果找到了目标颜色
      #  print(blobs)
        for blob in blobs:
        #迭代找到的目标颜色区域
            is_rect = False
            max_area = 0

            new_roi = expand_roi(blob.rect())
            rects=img.find_rects(roi=new_roi,threshold = 10000)
            if rects:
                is_rect=True
                for rect in rects:
                    print(rects)
                    if rect.w()*rect.h() > max_area:
                        max_area = rect.w()*rect.h()
                        max_circle = rect
                    img.draw_rectangle(max_circle.x(),max_circle.y(),max_circle.w(),max_circle.h())
    print(clock.fps())
5233f197-4c61-4e12-93cf-718e4bdb0d26.png
2019-09-11 10:35
I
网红小智智 星瞳科技

我使用OpenMV4测试这个代码,没有出现错误。

请提供一下出现错误的方法。

2022-02-13 09:43
O
bhkl
8263fe4f-eba7-45af-99fe-fbddc47e3083.png

小智智,我是在EDGR IMPULSE 导入神经网络出现这个错误,使用型号是OPENMV4 H7 CAM(不是PLUS),可以解决吗这个报错

:confounded_face:

O
bhkl
f1af6525-c7c7-4d6a-bf62-2cf63312a316.png
2022-02-14 18:47
I
网红小智智 星瞳科技

@bhkl edge impulse的模型只能在OpenmV4 Plus上用,OpenMV4不行。

2022-02-15 19:13
O
bhkl

@kidswong999 好,谢谢您