The random walker algorithm was introduced in the paper: Leo Grady and Gareth Funka-Lea, "Multi-Label Image Segmentation for Medical Applications Based on Graph-Theoretic Electrical Potentials" 随机游走的图像分割技术
Multiple Random Walkers Cosegmentation Multiple Random Walkers and Their Application to Image Cosegmentation Lee_Multiple_Random_Walkers_2015_CVPR_paper 中的实现。多随机游走图像 协同分割。windows下运行。
本文实例讲述了Python模拟随机游走图形效果。分享给大家供大家参考,具体如下:
在python中,可以利用数组操作来模拟随机游走。
下面是一个单一的200步随机游走的例子,从0开始,步长为1和-1,且以相等的概率出现。纯Python方式实现,使用了内建的 random 模块:
# 随机游走
import matplotlib.pyplot as plt
import random
position = 0
walk = [position]
steps = 200
for i in rang