I want to resize images. My images contain specific values [0, 1, 2, 7, 9]. After resizing, new values are introduced like 5 and whatnot. I want to prevent that.
I'm currently using scikit
image resize function. I've tried all interpolation flags but to no avail.
EDIT: a simple code to show the problem
import numpy as np
from skimage.transform import resize
vals = [0, 1, 4, 6]
N, M = 100, 100
image = np.random.choice(vals, N * M).reshape(N, M).astype('uint8')
resized_image = resize(image, (50, 50), preserve_range=True).astype('uint8')
print('vals before resizing ', np.unique(image))
print('vals after resizing ', np.unique(resized_image))