{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / draw / draw / bezier_curve

function

skimage.draw.draw:bezier_curve

source: /dev/scikit-image/src/skimage/draw/draw.py :717

Signature

def   bezier_curve ( r0 c0 r1 c1 r2 c2 weight shape = None )

Summary

Generate Bezier curve coordinates.

Parameters

r0, c0 : int

Coordinates of the first control point.

r1, c1 : int

Coordinates of the middle control point.

r2, c2 : int

Coordinates of the last control point.

weight : double

Middle control point weight, it describes the line tension.

shape : tuple, optional

Image shape which is used to determine the maximum extent of output pixel coordinates. This is useful for curves that exceed the image size. If None, the full extent of the curve is used.

Returns

rr, cc : (N,) ndarray of int

Indices of pixels that belong to the Bezier curve. May be used to directly index into an array, e.g. img[rr, cc] = 1.

Notes

The algorithm is the rational quadratic algorithm presented in reference [1].

Examples

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

Aliases

  • skimage.draw.bezier_curve