想在物体附近进行边缘检测,所以先剪切了图像,可是出现了报错
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
threshold = [150, 250] # Middle L, A, B values.
while(True):
clock.tick()
img = sensor.snapshot()
for blob in img.find_blobs([threshold], pixels_threshold=100, area_threshold=100, merge=True, margin=10):
#img.draw_rectangle(blob.rect())
img = sensor.set_windowing([blob.cx(),blob.cy(),blob.w(),blob.h()])
img.find_edges(image.EDGE_SIMPLE , threshold=(50, 80))
print(blob.x(),blob.y())