您当前的位置: 首页 >  ar
  • 0浏览

    0关注

    2393博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

成功解决AttributeError: 'NoneType' object has no attribute '__array_interface__'

一个处女座的程序猿 发布时间:2019-08-28 12:05:19 ,浏览量:0

成功解决AttributeError: 'NoneType' object has no attribute '__array_interface__'

 

 

 

 

目录

解决问题

解决思路

解决方法

原因及思路

网友最新推荐答案

 

 

 

 

 

解决问题

  File "F:\File_Python\Python_daydayup\1907DL\keras-yolo3\yolo.py", line 192, in detect_video     image = Image.fromarray(frame)   File "F:\Program Files\Python\Python36\Lib\site-packages\PIL\Image.py", line 2421, in fromarray     arr = obj.__array_interface__ AttributeError: 'NoneType' object has no attribute '__array_interface__'

 

 

解决思路

属性错误:“NoneType”对象没有属性“_array_interface__”

 

 

 

 

解决方法
while True: 
    return_value, frame = vid.read() 
    if return_value:
        print('当前数据读入正确,此处放入正确代码!')


    else:
        print('当前数据读入错误,跳出当前循环……')
        break

数据读取没有成功,也就是说,数据没有读进来。既然没有读进来,那只需要加一个判断:如果当前没有数据,则进行break即可! 如果有网友相关解释或者解决办法,请留言探讨,共同解决这个error,欢迎网友留言提供更好的思路!

 

 

网友推荐答案

注:把此代码放入到循环内部即可!

while True: 
    return_value, frame = vid.read() 
    if(return_value==False):
        print("******************************************************") 
        break

上述问题在于opencv读取视频,最后帧是为空,我们需要做一个判断,如果为空就跳出循环,问题解决了 。

 

 

 

 

 

 

 

 

 

 

 

关注
打赏
1664196048
查看更多评论
立即登录/注册

微信扫码登录

0.0572s