ABee
ABee

Reputation: 73

What is the replacement of cv2.cv.fromarray in opencv 3.2?

I am writing a face recognition program and the reference that I got from web was using previous OpenCV version. I am using OpenCV 3.2.0 build from source. In the reference to put the name just below the face in a video. My reference code looks like

cv2.putText(cv2.cv.fromarray(img), str(id), (x, y + h), font, 2, 255);

I get an error:

AttributeError: 'module' object has no attribute 'cv'

Please help.

Upvotes: 6

Views: 28446

Answers (1)

rbaleksandar
rbaleksandar

Reputation: 9701

For the Python API for OpenCV images are numpy arrays so fromarray() is not required (if available at all in the cv module).

See here for an example. You can just pass img to cv2.putText().

Upvotes: 9

Related Questions