# Use of Bresenham line algorithm to generate 1D profiles from a DTM

2 views (last 30 days)
Cai Ladd on 7 Jul 2014
Commented: Cai Ladd on 10 Jul 2014
Hello all, I'm wanting to quantify surface roughness of slumped material that form along saltmarsh creek margins. I will do this by measuring the Root Mean Square height of a 1-meter transect across the creek edge, to generate a graph of elevation (y) against distance (x). To do this, one must extract a 1D profile from a Digital Terrain Model (DTM). I'm hoping someone here can advise me how best to do this.
For a little more info on the problem, here's an extract from Bretar et al. (2013) on how the process of creating 1D profiles works:
"The Bresenham line algorithm determines which points should be selected in the regular grid DTM model to form a straight line. Detrending (i.e. subtraction of a best-fit line from the data, allows us to remove the influence of the local slope and to study the microrelief around a horizontal reference level" .
I have created a DTM using photogrammetry (a series of overlapping images, where the relative movement of pixels in each image is used to generate a 3D model. A scale bar included in each image allows the model have an accurate scale-factor associated with it). The fist step is to generate a dense point cloud using 'VisualSFM', and connect the points with a mesh, using 'MeshLab' (it is at this stage I apply the scaling-factor). Having generated the DTM, how do I go about employing the Bresenham line algorithm to extract a series of 1D profiles? Can this be done on MatLab?
Note: I'm not sure how to import a DTM to MatLab. I'm trying to work it out now. I'm not sure if, having generated a DTM on 'Meshlab', how to export that data as, say, an ASCII-file. I imagine it is then just a matter of importing ASCII into MatLab, and running the Bresenham line algorithm?

Spandan Tiwari on 7 Jul 2014
Edited: Spandan Tiwari on 7 Jul 2014
If you can morph the data into a 2D matrix, say as a 2D image, you can use the function improfile from the Image processing Toolbox to get 1D profiles.
Cai Ladd on 10 Jul 2014
Ah ok, that's a good idea. I've still got to generate the DTM model, but once done I'll report back to let you know how I got on.

### Categories

Find more on Lighting, Transparency, and Shading in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!