shitDjango
oneDjango
采纳率60%
2019-04-02 20:26

yolo video python cv2图像转PIL fromarray报错

已采纳

> 
> Traceback (most recent call last):
>   File "yolo_video.py", line 66, in <module>
>     detect()
>   File "yolo_video.py", line 60, in detect
>     detect_video(YOLO(**vars(FLAGS)), FLAGS.output)
>   File "/home/dwy5/wy/classface_yolo3/yolo.py", line 239, in detect_video
>     image = Image.fromarray(frame)
>   File "/root/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2508, in fromarray
>     arr = obj.__array_interface__
> AttributeError: 'NoneType' object has no attribute '__array_interface__'
> 
> 

经常异常终止报错

vid = cv2.VideoCapture(0)
···

···
return_value, frame = vid.read()
image = Image.fromarray(frame)
image = yolo.detect_image(image)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • weixin_42849517 weixin_42849517 2年前

    frame 对象是个NONE fromarray 这个方法不支持none对象

    点赞 评论 复制链接分享

相关推荐