zoukankan      html  css  js  c++  java
  • cv2.fillConvexPoly()与cv2.fillPoly()填充多边形

    cv2.fillConvexPoly()

    cv2.fillConvexPoly()函数可以用来填充凸多边形,只需要提供凸多边形的顶点即可.

    我们来画一个三角形

    img = np.zeros((1080, 1920, 3), np.uint8)
    triangle = np.array([[0, 0], [1500, 800], [500, 400]])

    cv2.fillConvexPoly(img, triangle, (255, 255, 255))

    plt.imshow(img)
    plt.show()

    cv2.fillPoly()

    cv2.fillPoly()函数可以用来填充任意形状的图型.可以用来绘制多边形,工作中也经常使用非常多个边来近似的画一条曲线.cv2.fillPoly()函数可以一次填充多个图型.

    img = np.zeros((1080, 1920, 3), np.uint8)
    area1 = np.array([[250, 200], [300, 100], [750, 800], [100, 1000]])
    area2 = np.array([[1000, 200], [1500, 200], [1500, 400], [1000, 400]])

    cv2.fillPoly(img, [area1, area2], (255, 255, 255))

    plt.imshow(img)
    plt.show()

    原文链接:https://blog.csdn.net/u012135425/article/details/84983265

  • 相关阅读:
    [VirtaulBox]网络连接设置
    LeetCode
    LeetCode
    LeetCode
    LeetCode-37.Sudok Solver
    LeetCode-36.Valid Sudoku
    LeetCode-52.N-Queen II
    LeetCode-51.N-Queens
    LeetCode-22.Generate Parentheses
    LeetCode-111.Mininum Depth of Binary Tree
  • 原文地址:https://www.cnblogs.com/Ph-one/p/12082692.html
Copyright © 2011-2022 走看看