I am currently coding a program to keep track of a running fly in a small chamber, what I want is XY-coordinates of the center of the fly.
For this I first filter each frame with a Gaussian filter using fspecial('gaussian',[30 30],100)
and imfilter
to get a white "cloud" where the fly is. I need this to reduce noise of the center of the fly.
I convert the outcome into a binary image using im2bw
with a certain threshold to get a white blob from the aforementioned cloud.
To get the coordinates, I use regionprops
that finds the centroid of the white blob.
It already works fine, but it takes ages - roughly 6 hours for 30 minutes of video; the framerate is 100 fps, though.
I have figured out that the Gaussian filtering takes up most of the time - can I tweak this process somehow?
I read about conv2
, which is said to be faster but it does not work on binary images, does it? And converting my binary images to single or double messes them up.
I already worked on the code's performance on other levels, like adjusting the search window etc., so the filtering is what is left as far as I can assess.
Thanks in advance