openmv连接LCD屏幕,如何提取文件夹中的照片或者视频显示在LCD屏幕上面?
import sensor, image, lcd,os
# 初始化摄像头
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time=2000)
# 初始化LCD
lcd.init()
# 图片文件的完整路径
image_file_path = "D:\图片.png" # 请将路径替换为您的图片文件路径
# 检查文件是否存在
if image_file_path in os.listdir("D:/"):
# 加载并显示图片
img = image.Image(image_file_path)
lcd.display(img)
else:
print("图片文件不存在:", image_file_path)这是我写的代码,会产生错误OSError: [Errno 22] EINVAL?请问如何解决?
https://book.openmv.cc/MCU/filesys.html
首先你的问题路径不对,程序是在OpenMV里运行的,无法访问你电脑的D盘。
第一步,运行
img.save("/example.bmp")
第二部运行。
https://book.openmv.cc/example/03-Drawing/copy2fb.html
然后最后添加lcd.display(img)