Hi all!
I have a specific problem that I think lends itself to a Kalman filter. Since I’ve never used a Kalman filter before and I’m not sure how exactly I could apply it on my data, I thought I’d reach-out here.
My data
I have time-lapse images of roots growing. As they grow they emit a bit of light from their tip. I want to track the trajectory of the root tips.
The image of the root tip looks like a blurry point source – the distribution of the light intensities sometimes looks almost like a gaussian (albeit not in the below example).
I can get an ok estimation of the location of the beginning of a root-tip so I know where to start in the image. I also have good guesses about the tip’s:
- speed
- angular speed (how quick it can change directions)
- range of possible directions (the root doesn’t grow “up”, it only grows with gravitation)
- intensity change (how the tip brightness degrades with time)
How
I read this excellent explanation about Kalman filters, I checked out the Kalman
, StateSpace
, DataAssim
, and StateSpaceRoutines
packages and I thought that I should be able to:
- Start with an initial tip location
- Guess the location of the tip in the next frame
- Extract a large enough region of interest (ROI) from that next frame centered on the guess
- Use the light distribution in that ROI to feed the Kalman filter with an estimation of the new location
Implementation
I’m a bit lost… Does anyone here have a good understanding of how I could use one of the available tools in Julia to accomplish this?
Thanks!
Example data
This will generate some data to play with:
sz = (100,100)
nframe = 10
imgs = rand(sz..., nframe);
t = 1:nframe
x = 1.1*t + sz[2]/2 + rand(nframe)
y = 7.8*t + 1 + rand(nframe)
i = [CartesianIndex(round(Int, y[frame]), round(Int, x[frame]), frame) for frame in 1:nframe]
imgs[i] = 5e3
using ImageFiltering
for frame in 1:nframe
imgs[:,:,frame] = imfilter(imgs[:,:,frame], Kernel.gaussian(2))
end