请大佬指点!
官方教程人脸识别,识别不同人脸。别的没有问题,只是这一行有问题: sensor.snapshot().save("singtown/s%s/%s.pgm" % (num, n) ) # or "example.bmp" (or others)
有SD卡,32G,闪迪。代码也换绝对路径试验过,没有用。
以下源码:
# Snapshot Example
#
# Note: You will need an SD card to run this example.
#
# You can use your OpenMV Cam to save image files.
import sensor, image, pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.B128X128) # or sensor.QQVGA (or others)
sensor.set_windowing((92,112))
sensor.skip_frames(10) # Let new settings take affect.
sensor.skip_frames(time = 2000)
num = 1 #设置被拍摄者序号,第一个人的图片保存到s1文件夹,第二个人的图片保存到s2文件夹,以此类推。每次更换拍摄者时,修改num值。
n = 20 #设置每个人拍摄图片数量。
#连续拍摄n张照片,每间隔3s拍摄一次。
while(n):
#红灯亮
pyb.LED(RED_LED_PIN).on()
sensor.skip_frames(time = 3000) # Give the user time to get ready.等待3s,准备一下表情。
#红灯灭,蓝灯亮
pyb.LED(RED_LED_PIN).off()
pyb.LED(BLUE_LED_PIN).on()
#保存截取到的图片到SD卡
print(n)
sensor.snapshot().save("singtown/s%s/%s.pgm" % (num, n) ) # or "example.bmp" (or others)
n -= 1
pyb.LED(BLUE_LED_PIN).off()
print("Done! Reset the camera to see the saved image.")sensor也换过,任然没有用。
重启软硬件,依旧没有用......
插拔SD卡,还是没有用QwQ
求救!
自己顶一下......实验发现,不加参数可以存,但是加了参数还是不能运行。各位大佬帮忙啊!
sensor.snapshot().save("singtown.jpg" ) # or "example.bmp" (or others)这个就可以,但是加了参数就不行:frowning_face:
https://forum.singtown.com/topic/4819/%E4%B8%BA%E4%BB%80%E4%B9%88%E6%8C%89%E7%85%A7%E5%AE%98%E6%96%B9%E6%95%99%E7%A8%8B%E8%BF%98%E6%98%AF%E6%8F%90%E7%A4%BA%E8%B7%AF%E5%BE%84%E9%94%99%E8%AF%AF-%E8%AF%95%E8%BF%87%E7%BB%9D%E5%AF%B9%E8%B7%AF%E5%BE%84%E4%B9%9F%E4%B8%8D%E8%A1%8C/2