Main functionality
%load_ext autoreload
%autoreload 2
Let's test our annotator on a sample project. It needs a list of triplets: path_to_img1
, path_to_img2
, path_to_corrs_to_save
.
import os
rootdir = 'sample_project'
pairs = os.listdir(rootdir)
img_pairs_list = []
for p in pairs:
if p == '.DS_Store':
continue
cur_dir = os.path.join(rootdir, p)
img_pairs_list.append((os.path.join(cur_dir, '01.png'),
os.path.join(cur_dir, '02.png'),
os.path.join(cur_dir, 'corrs.txt')))
print (img_pairs_list)
Now we are ready to initialize CorrespondenceAnnotator
. Don't forget to declare %matplotlib notebook
.
You also should explicitly specify, if you want to save (and possibly over-write previous better annotation) current correspondences automatically when clicking on prev and next buttons for going to the next pair.
%matplotlib notebook
CA = CorrespondenceAnnotator(img_pairs_list, save_on_next=False)
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:95% !important; }</style>"))
CA.start(figsize=(12,7))