quiz_helpers.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:AIND-VUI-quizzes 作者: udacity 项目源码 文件源码
def cv2_imshow(image, name='name'):
    """Display an OpenCV image (2D NumPy array) through the Udacity IDE."""

    global max_images, num_images

    if num_images >= max_images:
        print("WARNING: Exceeded max no. of imshow() calls ({}), no more images will be shown.".format(max_images))
        return
    num_images += 1

    ext = 'png'

    # encodedImage = cv2.cv.EncodeImage('.' + ext, cv2.cv.fromarray(image))  # OpenCV 2.3.x
    # bytes = encodedImage.tostring()

    retval, bytes = cv2.imencode('.' + ext, image)  # OpenCV 2.4.x

    output_image(name, ext, bytes)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号