Deep learning might have something to offer in the long term but at the expense of training the network with very detailed information about what constitutes an "outer wall". A deep learning network could then iterate all frames and markup those blocks that are very likely to constitute the "outer wall".
In the short term, a technique based on normalised cross correlation might offer more satisfactory results. The idea in this case is simple: Define an area of the image (let's call it a Region of Interest (ROI)) that you want to track and then try to "find" that area within the next frame and the next frame and so on.
The primary assumption here, of course, is that the ROI doesn't change significantly from frame to frame. And in this particular case, this takes us back to what exactly does an "outer wall" mean?
Here is an example of tracking a point on the "outer wall":
And here is the data of the track (frame num, X, Y).
This is the best tracking I could do out of approximately 8 attempts (I will come back to this) and it was done using Blender.
Blender is using the normalised cross correlation method to track "markers" from a video feed. Depending on the type and number of markers tracked, you can do a number of things such as stabilise video or solve for the camera movement and position in order to synchronise a "virtual" and a real scene.
In this particular case, I am only tracking Location. I could track Location, Rotation, Scale or any combination of those but I figured that this phenomenon is happening more or less on a narrow depth of field. So, just tracking for location will not distort the results.
The tracked coordinates are the green and red timeseries, green for a "Y" coordinate and red for a "X" coordinate.
As you can see, it's not a simple linear movement. The tracked marker seems to be prescribing a tiny little ellipse around its position.
And this brings us to the main "problem" you are going to have to deal with: WHAT is an outer wall? Here are a few observations:
The "outer wall" displacement varies across it's length. The "outer wall" of this membrane (?) is roughly parallel to the width of the video. So, the recorded displacement, really depends on WHERE you are going to track. If I tried to track somewhere else along the length of the track I would have had a different profile.
The "WHERE are you going track?" question is made harder, because the "outer wall" is semi-transparent and furthermore, its transparency throughout it's "pumping" cycle seems to depend on the phase of it. So, there are points in the cycle that there are very clearly defined edges (which is good for accurate tracking) but gradually, these points vanish and introduce drift to the tracking. Gradually, the marker will "slip" from the target it is supposed to be tracking and start tracking a slightly adjacent image patch that happens to look similar.
Therefore, what I would suggest is to set-up a similar script that opens a video, establishes a marker patch and then tracks the patch frame-by-frame, using information that is readily available in many different scientific platforms (for example, for another example).
BUT!, having now established tracking, you will have to go ahead and manipulate the successive frames of the video in order to preserve the features. This could be a simple contrast enhancement with a steep window, or a histogram equalisation or a normalisation step or possibly the addition of a high pass filter to make the edges more pronounced and improve tracking.
Finally, if you would like to replicate this tracking, using your video, you will need:
- Some demo on tracking. This one is very good.
- Specific parameters
- This tracking was produced with: Tracking Settings(Preset, Blurry Footage, Motion Model: Loc, Match: Previous Frame). You can match either on a frame-by-frame mode, or to a keyframe, in which case, you get displacements relative to that particular frame. Might be useful for you if you want to measure everything with respect to a particular point in the cycle.
- A script to extract the tracking data to a CSV file. Like this one.
(Of course, you can track as many markers as you like and their data will be put in a separate file).
Hope this helps.