def debug_history(self): iv = ImageViewer() iv.remove_axis_values() iv.add(self.source, 'source', cmap='bgr') for img, func in zip(self.debug_out_list, self.functions): iv.add(img, str(func), cmap='bgr') return iv
iv.add(img, str(func), cmap='bgr') return iv if __name__ == "__main__": from step_07_highlight_painting import highlight_paintings # from step_12_b_create_outer_rect import mask as mask_b from data_test.standard_samples import TEST_PAINTINGS, FISH_EYE, PEOPLE # By creating instantiating the Pipeline class you can pass as values # the list of functions that will be executed, passing as default value=True # The default functions will be set as the function pipeline pipeline = Pipeline(default=True) # The ImageViewer now no longer needs the number of images that will be inserted a priori iv = ImageViewer(cols=3) iv.remove_axis_values() plots = [] # I created a script to have the filenames of the images we use as tests # for filename in TEST_PAINTINGS: filename = "data_test/painting_09/00_calibration.jpg" img = np.array(cv2.imread(filename)) # Via the append command you can add a function to the pipeline, # In this case I have to do it because the last function takes as source img pipeline.append(Function(highlight_paintings, source=img, pad=100)) # Using the run command I execute the functions in order. # with debug=True for each step debug images are created that then # can be displayed in sequence # with print_time=True the times are printed for each function # Filename is optional, it's for printing out = pipeline.run(img, debug=True, print_time=True, filename=filename)