马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
"""
例2.11
生成一幅彩色图图像,让其中的像素值均为随机数
"""
import cv2
import numpy as np
img = np.random.randint(0,256,size=[256,256,3],dtype=np.unit8)
cv2.imshow('demo',img)
cv2.waitKey()
cv2.destroyAllWindows()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-d3be196aaa72> in <module>
6 import cv2
7 import numpy as np
----> 8 img = np.random.randint(0,256,size=[256,256,3],dtype=np.unit8)
9 cv2.imshow('demo',img)
10 cv2.waitKey()
/opt/anaconda3/envs/OpenCV-Python37/lib/python3.7/site-packages/numpy/__init__.py in __getattr__(attr)
218 else:
219 raise AttributeError("module {!r} has no attribute "
--> 220 "{!r}".format(__name__, attr))
221
222 def __dir__():
AttributeError: module 'numpy' has no attribute 'unit8'
|