Grec001
Grec001

Reputation: 1121

successfully import the OpenCV, but can't get it work

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

Upvotes: 1

Views: 61

Answers (1)

code-lukas
code-lukas

Reputation: 1651

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.

Upvotes: 1

Related Questions