【问题标题】:What is the replacement of cv2.cv.fromarray in opencv 3.2?opencv 3.2 中 cv2.cv.fromarray 的替换是什么?
【发布时间】:2017-10-10 22:38:40
【问题描述】:

我正在编写一个人脸识别程序,我从网上获得的参考资料是使用以前的 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'

请帮忙。

【问题讨论】:

    标签: python opencv3.0


    【解决方案1】:

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

    有关示例,请参阅 here。您可以将img 传递给cv2.putText()

    【讨论】:

      猜你喜欢
      • 2016-01-15
      • 2017-06-16
      • 2017-08-31
      • 1970-01-01
      • 1970-01-01
      • 2015-11-11
      • 2021-10-31
      • 1970-01-01
      • 2021-04-07
      相关资源
      最近更新 更多