USGS - science for a changing world

Pacific Coastal and Marine Science Center

Bedform Sedimentology Site—ripples, dunes, and cross-bedding

Grain Size from Digital Images of Sediment

Computer code

Rubin, D.M., 2004, A simple autocorrelation algorithm for determining grain size from digital images of sediment: Journal of Sedimentary Research, v. 74, p. 160-165. doi:10.1306/052203740160
Example of basic code for obtaining grain size using calibrated spatial autocorrelation.

Grain-size toolbox created by Dan Buscombe

Buscombe, D., and Rubin, D.M., 2012, Advances in the Simulation and Automated Measurement of Well-Sorted Granular Material, Part 2: Direct Measures of Particle Properties: Journal of Geophysical Research - Earth Surface, 117, F02002, doi:10.1029/2011JF001975.

Buscombe, D., Rubin, D.M., and Warrick, J.A., 2010, A universal approximation of grain size from images of noncohesive sediment: Journal of Geophysical Research, v.115, F02015, doi:10.1029/2009JF001477. (840 K PDF)

Download the code

Matlab (April 2012, Version 2) (46 kb)
Matlab Manual (7.2 MB)

Python (March 2012, Version 2) (12 kb)

Matlab (May 2011, Version 1) (44 kb) (17.6 MB)

Python (May 2011, Version 1) (10 kb) (6.5 MB)

Cobble Cam

Warrick, J.A., Rubin, D.M., Ruggiero, P., Harney, J., Draut, A.E., and Buscombe, D., 2009, Cobble cam: grain-size measurements of sand to boulder from digital photographs and autocorrelation analyses: Earth Surface Processes and Landforms 34, 1811-1821, doi:10.1002/esp.1877. (834 K PDF)
Code for grain size of sand, gravel, and cobbles
The following files can be used to conduct 'Cobble Cam' grain size analyses on digital photographs as described in Warrick et al. (2009). Please see the read_me.rtf file for more information.

Download the code

Download the whole folder as a .zip:; or as individual files listed below:


Accessibility FOIA Privacy Policies and Notices

U.S. Department of the Interior | U.S. Geological Survey
URL: seds/grainsize/code.html
Page Contact Information: Web Team
Page Last Modified: 2 May 2012 (lzt)