%run ../../common.ipynb
import cv2, scipy, tifffile
from IPython.html.widgets import interact, IntTextWidget
Populating the interactive namespace from numpy and matplotlib
img = scipy.misc.lena().astype(np.uint8)
def fn(low_threshold, high_threshold):
edges = cv2.Canny(img, low_threshold, high_threshold)
figure(figsize=(16,8))
plt.subplot(121)
plt.imshow(edges, cmap="gray")
plt.subplot(122)
plt.imshow(img, cmap="gray")
interact(fn, low_threshold=IntTextWidget(min=10, max=1000, value=50), high_threshold=IntTextWidget(min=10, max=1000, value=100))
<function __main__.fn>
%pylab qt
img = tifffile.imread('../mp.tif')
interact(fn, low_threshold=IntTextWidget(min=10, max=1000, value=50), high_threshold=IntTextWidget(min=10, max=1000, value=100))