def anim(func, time_length, interval=0.1, width=400): img = Image_widget(width=width) display(img) start_time = time.time() for t in np.arange(0, time_length, interval): frame = Image.fromarray((func(t)*255).astype('uint8')) img.value = frame._repr_png_() now = time.time() if now < start_time+t: time.sleep(start_time+t-now)
wImg_dst2 = Image(layout=Layout(border="solid"), width="45%") wImg_dst3 = Image(layout=Layout(border="solid"), width="45%") items = [wImg_original, wImg_dst] items2 = [wImg_dst2, wImg_dst3] Left_image = Box(items) Right_image = Box(items2) box = layout(IntSlider_Threshold, Left_image, Right_image) tab_nest = widgets.Tab() tab_nest.children = [box] tab_nest.set_title(0, 'Fast Feature Detect1') tab_nest tmpStream = cv2.imencode(".jpeg", src)[1].tostring() wImg_original.value = tmpStream display.display(tab_nest) #Event 선언 threshold = 1 def on_value_change_Threshold(change): global threshold threshold = change['new'] make_fastfeature(threshold) def make_fastfeature(input_threshold): fastF = cv2.FastFeatureDetector.create(threshold=input_threshold)