I am trying to create a 16-bit image like so:
import skimage
import random
from random import randint
xrow=raw_input("Enter the
I guess you may have this problem in Pycharm. If so, you may try this to your problem.
Go to File-Setting-Tools-Python Scientific
in Pycharm and remove the option of Show plots in tool window
.
In my case image path
was wrong! So firstly, you might want to check if image path is correct :)
I was also getting this error, and the answers given above says that we should upload them first and then use their name instead of a path - but for Kaggle dataset, this is not possible.
Hence the solution I figure out is by reading the the individual image in a loop in mpimg format. Here we can use the path and not just the image name.
I hope it will help you guys.
import matplotlib.image as mpimg
for img in os.listdir("/content/train"):
image = mpimg.imread(path)
plt.imshow(image)
plt.show()
This happened for me when I was trying to plot an imagePath, instead of the image itself. The fix was to load the image, and plotting it.
As for cv2 is concerned.
cv2.imread()
.
eg jpg instead of png.plt.imshow(img_path)
,try cv2.imread(img_path)
first then plt.imshow(img)
or cv2.imshow(img)
.
Try to use this,
plt.imshow(numpy.real(A))
plt.show()
instead of plt.imshow(A)