Solved by ptrblck in post #2 
              
              
                It seems you are passing the image path to process_image instead of an PIL.Image. 
Try to load the image and pass it to the function: 
from PIL import Image

test_image_path = ...
test_image = Image.open(test_image_path)
process_image(test_image)