def test_chunk_transform(): img = _img() assert np.sum(img == 0) != 0 # assert that there are some 0,0,0 pixels zero_at = np.where(img == 0) def transform(chunk): chunk[chunk == 0] = 100 return chunk chunks = nphusl.chunk_img(img, 10) nphusl.chunk_transform(transform, chunks, img) assert np.sum(img == 0) == 0 assert np.all(img[zero_at] == 100)
def main(img_int, chunksize): img_float = img_int / 255.0 out = np.zeros(img_float.shape, dtype=np.float) chunks = nphusl.chunk_img(img_float, chunksize=chunksize) nphusl.chunk_transform(nphusl.rgb_to_husl, chunks, out)