Python opencv 3.2中cv2.cv.fromarray的替换是什么?

Python opencv 3.2中cv2.cv.fromarray的替换是什么?,python,opencv3.0,Python,Opencv3.0,我正在写一个人脸识别程序,我从网上得到的参考是使用以前的OpenCV版本。我正在使用OpenCV 3.2.0从源代码构建。在参考中,在视频中将名称放在脸的正下方。我的参考代码看起来像 cv2.putText(cv2.cv.fromarray(img), str(id), (x, y + h), font, 2, 255); 我得到一个错误: AttributeError: 'module' object has no attribute 'cv' 请提供帮助。用于OpenCV图像的Pytho

我正在写一个人脸识别程序,我从网上得到的参考是使用以前的OpenCV版本。我正在使用OpenCV 3.2.0从源代码构建。在参考中,在视频中将名称放在脸的正下方。我的参考代码看起来像

cv2.putText(cv2.cv.fromarray(img), str(id), (x, y + h), font, 2, 255);
我得到一个错误:

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

请提供帮助。

用于OpenCV图像的Python API是
numpy
数组,因此不需要
fromarray()
(如果在
cv
模块中提供)

有关示例,请参见。您只需将
img
传递到
cv2.putText()