def test_pixel_at(): global image size = image_size(image) # 2. pixel index to row, col assert (500, 2) == pixel_at_index(1700, size) # 3. row, col to pixel index assert 1700 == index_at_pixel(500, 2, size) assert 120400 == index_at_pixel(400, 200, size)
def __init__(self, image_file, label_file, patch_size=(101, 101)): self.input = prepared_dataset_image(image_file, border=patch_size) self.image_size = image_size(prepared_dataset_image(image_file)) self.patch_size = patch_size width, height = self.image_size self.output = np.zeros((height, width)) self.verbose = TT.verbose for (col, row, p) in load_csv(label_file): self.output[row, col] = 1.0
def image_size(self): if not hasattr(self, '_image_size'): self._image_size = image_size( prepared_dataset_image( os.path.join(self.root_path, self.files[0][0]))) return self._image_size
def test_image_size(): global image # 1. Image size size = image_size(image) assert (600, 300) == size