I an image processing enginner, and am using Python as a prototyping language.
Most of the time, as I get thousands of images, named "imagen.jpg", n being the increment.
So the main structure of my program may be seen as :
def main_IP(imgRoot, stop_ncrement):
name = update_the_increment(imgRoot, stop_increment)
img = load_the_image(name)
out_img = process_image(img)
displays_images(img, out_img)
return out_img
As you can see it, from one application to another, the only change would be the process_image function. Is there a way so that the process_image can be inserted as an input?
I would get a generic function, prototyped as : main_IP(imgRoot, stop_increment, process_image)
Thanks ! Julien
Functions can be passed around in python just like a string or any other object can.
def processImage(...):
pass
def main_IP(imgRoot, stop_ncrement, process_image):
name = update_the_increment(imgRoot, stop_increment)
img = load_the_image(name)
out_img = process_image(img)
displays_images(img, out_img)
return out_img
main_IP('./', 100, processImage)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With