Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv2.imread() gives None, but the path/cwd is correct

Hello,

I had this problem already and it was solved without any clear reason. I had my Jupyter Notebook tab open and didn't change anything and then it worked. I already read articles and other threads on this, but couldn't find a solution for this; just look at my screenshot:

image description

cv2.imread() gives None, but the path/cwd is correct

Hello,

I had this problem already and it was solved without any clear reason. I had my Jupyter Notebook tab open and didn't change anything and then it worked. I already read articles and other threads on this, but couldn't find a solution for this; just look at my screenshot:

image description

On a PyImageSearch blog post I read that this can happen with bad compiling, such as JPEGs. But this doesn't make sense: It already worked a few hours ago and I could display the img with plt.imshow(). (Not with cv2.imshow(), that leads to my kernel crashing.)

cv2.imread() gives None, but the path/cwd is correct

Hello,

I had this problem already and it was solved without any clear reason. I had my Jupyter Notebook tab open and didn't change anything and then it worked. I already read articles and other threads on this, but couldn't find a solution for this; just look at my screenshot:

PATH = "savefig/plotXBIC_singlecell/01.png"
img = cv2.imread(PATH)
print(img)
print(path.exists(PATH))

None True

image description

On a PyImageSearch blog post I read that this can happen with bad compiling, such as JPEGs. But this doesn't make sense: It already worked a few hours ago and I could display the img with plt.imshow(). (Not with cv2.imshow(), that leads to my kernel crashing.)