logo

模板匹配(插了内存卡) MmemoryError:Out of fast Frame Buffer Stack

2019-10-11 11:07
X
goe2

![0_1570763155002_微信截图_20191011110325.png](https://fcdn.singtown.com/255f19ca-35d0-

import sensor, image, time
from image import SEARCH_EX, SEARCH_DS


# Set sensor settings
#sensor.set_contrast(1)
#sensor.set_gainceiling(16)

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)




# Load template.
# Template should be a small (eg. 32x32 pixels) grayscale image.
template = image.Image("/template.pgm")



clock = time.clock()

while(True):
    clock.tick()
    img = sensor.snapshot()
    
    if img.format() != sensor.GRAYSCALE:
        imge = img.to_grayscale()  #默认False , True内存溢出
        r = imge.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
        if r:
            img.draw_rectangle(r,color = (0, 0, 0), thickness = 1, fill = False)
        else:
            ROI_X=50
            ROI_Y=13
            ROI_W=60
            ROI_H=80 
            ROI=(ROI_X,ROI_Y,ROI_W ,ROI_H) 
            img.draw_rectangle(ROI,color = (0, 0, 0), thickness = 1, fill = False)
        
    print(clock.fps())

4c49-bfb2-4d9b7fe2e12d.png)

X
goe2
be9c49bf-d5ee-4f41-920d-3d825003a33d.png
2019-10-11 12:45
I
网红小智智 星瞳科技

https://forum.singtown.com/topic/558/memory-error-fb-alloc-collision-%E5%86%85%E5%AD%98%E4%B8%8D%E5%A4%9F%E4%B8%8E%E5%83%8F%E7%B4%A0%E4%BD%8E