Interact with widgets#
Use the ipywidgets
module to create interactive widgets to help you investigate OpenCV functions easily.
import cv2
import matplotlib.pyplot as plt
from skimage import data
from ipywidgets import interact, interactive, fixed, interact_manual
def f(thresh_low=100, thresh_high=200):
img_ = cv2.Canny(img, thresh_low, thresh_high)
plt.imshow(img_, cmap = 'gray')
plt.axis('off')
rgb_img = data.coffee()
img = rgb_img.copy()
interact(f, thresh_low=(0,400), thresh_high=(0,400))

Find more information for interact
on the official documentation.