Skip to content Skip to sidebar Skip to footer

Python Image Filtering With Pil And Numpy Too Slow

I'm trying to implement the simpliest Gauss filter in Python with PIL and Numpy. All works fine but very slowly :( Can't figure out how to speed up. Could you help? import os, sys

Solution 1:

Have a look at the answers for this question here.

Gaussian blur filters are separable, which means you can reduce the complexity of your algorithm quite a bit (on top of looking into the suggestions from other answers, i.e. parallelization).

Solution 2:

Have you tried profiling this? If you find where you're spending most of your time, it will be more obvious where to concentrate on optimising.

Parts of this look embaressingly parralel, you might wish to use multithreading or multiprocessing for these, depending on whether most of thde time is spend executing python in the GIL or numpy outside of it.

Post a Comment for "Python Image Filtering With Pil And Numpy Too Slow"