本文整理匯總了Python中snake.Snake.addControlPoints方法的典型用法代碼示例。如果您正苦於以下問題:Python Snake.addControlPoints方法的具體用法?Python Snake.addControlPoints怎麽用?Python Snake.addControlPoints使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類snake.Snake
的用法示例。
在下文中一共展示了Snake.addControlPoints方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: exportSplineImage
# 需要導入模塊: from snake import Snake [as 別名]
# 或者: from snake.Snake import addControlPoints [as 別名]
def exportSplineImage(size=500, cps=4):
from snake import Snake
size = 500
rnd = lambda: np.random.randint(0, size)
image = vigra.RGBImage((size, size), value=4.0)
snake = Snake(image=image)
snake.addControlPoints(*[(rnd(), rnd()) for i in range(cps)])
gs = contourCurvatureGradient(snake.contour, snake.controlpoints, snake.crv_energies)
for i in range(len(gs)):
image[snake.contour[i][0]][snake.contour[i][1]] = [125*gs[i], 255 - (125*gs[i]), 0]
vigra.impex.writeImage(image, '/home/max/Desktop/spline_colours.png')