First time here? Check out the FAQ!

Ask Your Question
0

cv2.imread returns None

asked Feb 23 '16

JJG gravatar image

as the title states, when I do

im = cv2.imread("path\to\image.jpg")

and I've made sure the image is there, I get None in im I've imported cv2, and can't think of why this is happening. (Python 2.7, opencv 3.0.0). anyone have any idea? Thanks!

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Feb 23 '16

zshn25 gravatar image

Try replacing \ with / in your path to image. Also, try copying the image in your program folder and just give

im = cv2.imread("image.jpg")

cv2.imshow("", im)

cv2.waitKey(0)

Preview: (hide)

Comments

I had to put the image in the program folder to make it work... lame.

wannaBrobot gravatar imagewannaBrobot (Jul 13 '18)edit

Question Tools

1 follower

Stats

Asked: Feb 23 '16

Seen: 20,972 times

Last updated: Feb 23 '16