microsoft/presidio

SegmentedAdaptiveThreshold in image_processing_engine typo?

emmantel opened this issue · 2 comments

Hello, first time describing a 'bug' (not sure if this is the right place)

In the presidio_image_redactor, image_processing_engine.py, class SegmentedAdaptiveThreshold, preprocess_image(),
line 191,

if isinstance(image, np.ndarray):
            image = self.convert_image_to_array(image)

I believe this should be

if not isinstance(image, np.ndarray):
            image = self.convert_image_to_array(image)

since the point of this line is to convert PIL images to np ndarray and passing in an ndarray will simply return it unchanged. I was getting an error trying to run preprocess_image with a PIL Image as input, but changing that line fixed it. Let me know if I ma misunderstanding something!

Best,
Emma

Hi @emmantel, you're right, this is indeed a bug. Are you interested in creating a PR?