Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 349
ABee Avatar asked Mar 09 '23 02:03

ABee


1 Answers

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().

like image 110
rbaleksandar Avatar answered Mar 20 '23 17:03

rbaleksandar