Video Processing. Do I use impixel or improfile functions?

Hi all,
My task is to develop a MATLAB code that will analyse a video of waves wunning up and down a beach. What I want to find is the maximum height the water propagates up the beach after each wave. Having converted each frame to an image, I was wondering what might be the best way to go about measuring this.
What I was thinking was to use the improfile function for a line along the foreshore. I could plot the pixel intensity along the line, to then see where the large change in intensity is (indicating the wavefront). I would have to do this for each frame/image - or produce a code that gives the distance value at which the large change in intensity is found for each image. Roughly speaking.
I would be grateful for all thoughts and advice. Many thanks!

2 Comments

Can you upload your video somewhere? It would help to visualize it.
I will do, however, the video is currently being digitsed from VHS to a digital format, so will not be able to do so for a few days.

Sign in to comment.

 Accepted Answer

There is built-in edge detection as part of the Computer Vision Toolbox, which can be used directly on video.
This demo shows it in action.

4 Comments

Thanks Ryan. I had not considered the Computer Vision Toolbox, I've never used it before. My only concern is that the irregular nature of the wavefront might make it difficult to actually define the edge. But I guess i'll need to do some more research into how it works. Thanks again.
I would suggest trying out the methods available on the documentation page for the vision.edgedetectorclass.
Although the edges in the video demo don't move, it is processed frame by frame so should technically work if you can find the edge of the wave. There is another demo that utilizes the Simulink blocks instead but it's the same algorithms either way. I'm personally a Simulink fan so I would go that way but it would be intimidating if you haven't used it before.
K E
K E on 17 Aug 2012
Edited: K E on 17 Aug 2012
If you do not have these toolboxes, there are several edge detections algorithms in the File Exchange which turn up with this search,
site:http://www.mathworks.com/matlabcentral/fileexchange "edge detection"
This is because there is a pretty developed literature on the subject (and also your application, for example here; might be worth further literature review on how others are doing this). Your initial approach sounds reasonable and a more complicated approach may not be required; compare your automatically detected location to what you see in the image and decide if you like the results. If they are noisy but you are taking a lot of video, you may be able to average out the noise in some way, for example by fitting a tidal cycle to runup distance vs. time. Sounds like a fun project, good luck!
Thanks very much for your help K E and Ryan G. I don't have the computer vision toolbox, so will try out the image processing method.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!