cv2.fillPoly 和 cv2.fillConvexPoly:非凸任意形状填充和凸填充
2017-07-01 10:19
351 查看
cv2.fillConvexPoly:
官方文档:The function fillConvexPoly draws a filled convex polygon. This function is much faster than the function fillPoly . It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).
使用方法:
cv2.fillPoly:
官方文档:The function fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.
使用方法:
如果有多个形状:
官方文档:The function fillConvexPoly draws a filled convex polygon. This function is much faster than the function fillPoly . It can fill not only convex polygons but any monotonic polygon without self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) twice at the most (though, its top-most and/or the bottom edge could be horizontal).
使用方法:
import cv2 import numpy a = numpy.zeros((10,10)) triangle = numpy.array([ [1,3], [4,8], [1,9] ], numpy.int32)#[1,3],[4,8],[1,9]为要填充的轮廓坐标 cv2.fillConvexPoly(a, triangle, 1)
cv2.fillPoly:
官方文档:The function fillPoly fills an area bounded by several polygonal contours. The function can fill complex areas, for example, areas with holes, contours with self-intersections (some of their parts), and so forth.
使用方法:
cv2.fillPoly(a, [triangle], 1)
如果有多个形状:
cv2.fillPoly(a, [triangle, square, hexagon], 1)
相关文章推荐
- C#用GDI画任意形状的form
- 图形界面上的任意形状图形按钮
- (转载)OpenCV_提取图片中任意形状的区域
- 教你把UIView切成任意形状 通过ShapeLayer
- C#用GDI画任意形状的form
- 教你把UIView切成任意形状
- OpenGL: 填充非凸多边形 (转)
- OpenGL填充非凸多边形(网格化)
- opencv 3.0 填充矩形 填充多边形 fillPoly
- swing重绘按钮为任意形状
- 实现任意角度渐变填充(三) -- 多色渐变填充文字
- HTML5画布形状填充教程
- opencv任意形状ROI
- 自制3D显示引擎七:填充任意多边形
- 自定义pictureBox 控件 任意形状(圆形)
- 提取图片中任意形状的区域
- cvApproxPoly的学习(找任意形状)
- swing重绘按钮为任意形状图案的方法
- 教你把UIView切成任意形状
- EasySwift/YXJTagView 极其强大的标签框架,不仅可以填充文字,任意视图都可以