This happens when PyCharm can't guess the type of the object returned by method -
imread() in this case. Some methods return different types of object based on the input. You'd have to take a look into opencv source code to see why it isn't clear what the returned type is. Static analysis of the code detects obvious cases.
IPython has already executed the method, so it's clear what type was returned.
One solution, if you know the type returned, is to use type comments like this:
# I've checked with IPython that the returned object is a `numpy.ndarray` instance
img = cv2.imread('/home/me/Pictures/image.jpg') # type: numpy.ndarray
And then if you type
img. you will see
The feauture is described on PEP 0484.
This PEP says it's introduced in Python 3.5. However it might be that PyCharm could handle this simple case in older Python versions than 3.5 but I haven't check.
This PEP describes features of
typing module which is not available in older Python versions, so most of the features from this document won't work but I'm not sure if PyCharm is really using
typing module to parse type comments or does it natively.