1

I am new to python. Just trying to get the basic idea of python. Here is how I try and get error msg, after I installed the package.

import cv2 import numpy as np img = cv2.imread('lena.jpg') print(img.shape) 

but i just get a 'NoneType' msg.

It seems I successfully import the openCV package, but I just can't use its functions.

I did move the 'lena.jpg' to the same directory, but still get error msg.

Please advise how I can move on.

error msg

lena is with us

1
  • Are u sure the lena.jpg file is in the same directory? Commented Apr 1, 2020 at 16:53

1 Answer 1

1

It's most likely that lena.jpg is not in your current working directory. Try specifying the exact path to your image or moving the file to the same directory as your test.py.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, you are correct. I did move the jpg to the same directory, but it seems the working directory is not at where I thought. Whne I indicate the full path. It works.
You can use import os and os.getcwd() to get your current working directory, then it should just be a matter of copying the file to the same directory.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.