def get_pix_2_mm(file): im = images.read_img(file) # crop_result = images.crop_polygon(im) # p = crop_result.points # pixel_distance = sqrt((p[1, 0]-p[0, 0])**2 + (p[1, 1]-p[0, 1])**2) pixel_distance = 823 mm_distance = 215 print(f"pixel distance: {pixel_distance}") return mm_distance/pixel_distance
def test_circle_image(self): filepath = os.path.join(data_dir, "maxresdefault.jpg") im = images.read_img(filepath) images.OpeningGui(im)
def test(self): filepath = os.path.join(data_dir, "maxresdefault.jpg") im = images.read_img(filepath, True) images.ContoursGui(im)
def test(self): filepath = os.path.join(data_dir, "maxresdefault.jpg") im = images.read_img(filepath, True) images.AdaptiveThresholdGui(im)
def test_circle_grayscale_image(self): print('GRAY') filepath = os.path.join(data_dir, "maxresdefault.jpg") im = images.read_img(filepath, True) images.CircleGui(im, rmax=500) print('Finished')
def test(self): filepath = os.path.join(data_dir, "maxresdefault.jpg") im = images.read_img(filepath) im = images.rotate(im, 90) images.display(im)
def test_read_jpg(self): filepath = os.path.join(data_dir, "SampleImage.jpg") # filepath = pkg_resources.resource_filename(__name__, path) im = images.read_img(filepath) self.assertTrue(type(im) == np.ndarray) self.assertTrue(np.shape(im)[2] == 3)
def test_read_jpg_grayscale(self): filepath = os.path.join(data_dir, "SampleImage.jpg") im = images.read_img(filepath, grayscale=True) self.assertTrue(len(np.shape(im))==2)