def setUp(self): self.repo = DirectoryRepo('test_repo') self.gui = GUI( GeistFakeBackend(image=np.array( [[[255, 0, 0], [240, 10, 10], [0, 255, 0], [0, 0, 255]], [[255, 0, 0], [240, 10, 10], [0, 255, 0], [0, 0, 255]], [[255, 0, 0], [240, 10, 10], [0, 255, 0], [0, 0, 255]], [[255, 0, 0], [240, 10, 10], [0, 255, 0], [0, 0, 255]]]))) self.V = Viewer(self.gui, self.repo) self.screen = self.gui.capture_locations()[0] self.red = np.array([[[255, 0, 0]]]) self.more_reds = np.array([[[255, 0, 0], [240, 10, 10]]])
def setUp(self): self.repo = DirectoryRepo('test_repo') self.gui = GUI(GeistFakeBackend()) self.V = Viewer(self.gui, self.repo) # first need to save some images to repo self.image = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0]]) self.image2 = np.array([[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) self.image3 = np.array([[[255,0,0],[240,10,10],[0,255,0],[0,0,255]]], dtype=np.int32) self.V._save('test_file_1', self.image, force=True) self.V._save('test_file_2', self.image2, force=True) self.V._save('test_file_3', self.image3, force=True)
Use the viewer object to capture images and test finders in an interactive ipython """ try: get_ipython().magic('pylab') except (NameError, ): pass from geist.backends import get_platform_backend from geist import ( GUI, DirectoryRepo, ) from geist.pyplot import Viewer # Mark the directory listed as the current image repository repo = DirectoryRepo( "C:\some_filepath") # <--------------- EDIT ME!!!!!!!!!!!!!!! # Start a Geist backend, takes an optional screen number to capture. backend = get_platform_backend() # Start a Geist GUI gui = GUI(backend) # Viewer object can be used to display results in image form viewer = Viewer(gui, repo)