用法:
skimage.draw.bezier_curve(r0, c0, r1, c1, r2, c2, weight, shape=None)
生成贝塞尔曲线坐标。
- r0, c0:int
第一个控制点的坐标。
- r1, c1:int
中间控制点的坐标。
- r2, c2:int
最后一个控制点的坐标。
- weight:双倍的
中间控制点权重,说明线张力。
- shape:元组,可选
用于确定输出像素坐标的最大范围的图像形状。这对于超过图像大小的曲线很有用。如果没有,则使用曲线的全部范围。
- rr, cc:(N,)int的ndarray
属于贝塞尔曲线的像素的索引。可用于直接索引到数组中,例如
img[rr, cc] = 1
。
参数:
返回:
注意:
该算法是参考 [1] 中介绍的有理二次算法。
参考:
- 1
A Rasterizing Algorithm for Drawing Curves, A. Zingl, 2012 http://members.chello.at/easyfilter/Bresenham.pdf
例子:
>>> import numpy as np >>> from skimage.draw import bezier_curve >>> img = np.zeros((10, 10), dtype=np.uint8) >>> rr, cc = bezier_curve(1, 5, 5, -2, 8, 8, 2) >>> img[rr, cc] = 1 >>> img array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
相关用法
- Python skimage.draw.random_shapes用法及代码示例
- Python skimage.draw.polygon2mask用法及代码示例
- Python skimage.draw.ellipse_perimeter用法及代码示例
- Python skimage.draw.line用法及代码示例
- Python skimage.draw.set_color用法及代码示例
- Python skimage.draw.circle_perimeter用法及代码示例
- Python skimage.draw.polygon用法及代码示例
- Python skimage.draw.rectangle_perimeter用法及代码示例
- Python skimage.draw.ellipse用法及代码示例
- Python skimage.draw.polygon_perimeter用法及代码示例
- Python skimage.draw.circle_perimeter_aa用法及代码示例
- Python skimage.draw.line_nd用法及代码示例
- Python skimage.draw.disk用法及代码示例
- Python skimage.draw.rectangle用法及代码示例
- Python skimage.draw.line_aa用法及代码示例
- Python skimage.data.binary_blobs用法及代码示例
- Python skimage.data.file_hash用法及代码示例
- Python skimage.feature.graycomatrix用法及代码示例
- Python skimage.color.lab2lch用法及代码示例
- Python skimage.feature.blob_doh用法及代码示例
注:本文由纯净天空筛选整理自scikit-image.org大神的英文原创作品 skimage.draw.bezier_curve。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。