def test_graphcut():
import matplotlib.pyplot as plt
from scipy.misc import lena
im = lena()
# Any bigger and my weak laptop gets memory errors
bounds = (50, 50)
im = imresize(im, bounds, interp="bicubic")
all_matches, all_splits = graphcut(im, split_type="mean")
to_plot = all_splits[-1]
f, axarr = plt.subplots(2, len(to_plot) // 2)
for n in range(len(to_plot)):
axarr.ravel()[n].imshow(to_plot[n], cmap="gray")
axarr.ravel()[n].set_xticks([])
axarr.ravel()[n].set_yticks([])
plt.show()