opencv 代码集合

画有颜色的轮廓
import numpy
triangle = numpy.array([ [100,300], [400,800],[200,500] ], numpy.int32)#[1,3],[4,8],[1,9]为要填充的轮廓坐标
cv2.fillConvexPoly(image, triangle, (0, 0, 255))
cv2.imshow("fff", image)
cv2.waitKey (0)
cv2.destroyAllWindows()



fillPoly可以任意多个多边形
https://www.pianshen.com/article/5724129910/

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://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_tutorials.html

 

 

 

颜色识别 几个例子

https://www.pythonf.cn/read/33800   里面有个bug,参考https://blog.csdn.net/lyiiiiii61/article/details/78999917

 

http://www.jeepxie.net/article/62200.html

https://blog.csdn.net/Monster_H7/article/details/103558345

https://www.freesion.com/article/7536775614/

 

OpenCV之bitwise_and、bitwise_not等图像基本运算及掩膜

https://blog.csdn.net/u011028345/article/details/77278467 

posted @ 2020-09-26 00:27  Daniel_Lu  阅读(427)  评论(0编辑  收藏  举报