I’m writing a library to process gaze tracking in Python, and I’m rather new to the whole numpy / scipy world. Essentially, I’m looking to take an array of (x,y) values in time and “paint” some shape onto a canvas at those coordinates. For example, the shape might be a blurred circle.
The operation I have in mind is more or less identical to using the paintbrush tool in Photoshop.
I’ve got an interative algorithm that trims my “paintbrush” to be within the bounds of my image and adds each point to an accumulator image, but it’s slow(!), and it seems like there’s probably a fundamentally easier way to do this.
Any pointers as to where to start looking?
In your question you describe a Gaussian filter, for which scipy has support via a package.
For example:
Of course, you can apply this on the whole image, or just on a patch, using slicing:
For basic image manipulation, the Python Image library (PIL) is probably what you want.
NOTE:
for “painting” with a “brush”, I think you could just create a boolean mask array with your brush. For instance: