Created
November 8, 2018 17:53
-
-
Save pranav083/6ad4db8da1e569902825f7789e2e8cf4 to your computer and use it in GitHub Desktop.
How to fix AttributeError: module 'numpy' has no attribute 'unit8'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################### | |
###import function | |
import numpy as np | |
import cv2 | |
####################################### | |
####################################### | |
###read the image | |
img =np.zeros((400,400),np.unit8) | |
####################################### | |
####################################### | |
###Do the processing | |
#############df########################## | |
####################################### | |
### show the image | |
cv2.imshow('image',img) | |
####################################### | |
####################################### | |
### close and exit | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() | |
####################################### | |
error: | |
Traceback (most recent call last): | |
File "F:\Ubuntu_backup\eYRC#2683\Tutorials\Tutorials\2_exploring_the_image_matrix\3_makeChessboard\test_6.py", line 9, in <module> | |
img =np.zeros((400,400),np.unit8) | |
AttributeError: module 'numpy' has no attribute 'unit8' | |
[Finished in 0.4s] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have used unit8 in your code. But NumPy has no attribute named unit8. You have to use uint8 instead of unit8 in your code. So make changes in your code and try once again. It will work.