In [1]:
import numpy as np
import skimage
import skimage.io
import skimage.transform
import skimage.morphology
import poie as ps
import matplotlib.pyplot as plt
from matplotlib.widgets import RectangleSelector
import matplotlib.animation as animation
import cv2
%matplotlib notebook
Loading the background image.
In [2]:
back = skimage.io.imread('backgrounds/Starwars.jpg').astype(float)
Interface for area selection
In [3]:
def onselect(click, release):
pass
fig, ax = plt.subplots(figsize=(10, 7))
ax.imshow(ps.to_uint8(back))
toggle_selector = RectangleSelector(ax, onselect, interactive=True)
cid = fig.canvas.mpl_connect('key_press_event', toggle_selector)
plt.show()