For a mining research application I need to determine what percentage of a crushed stone is a particular colour.

While I cannot post them, I have many photographs of a gravel-like product that is multicoloured. The microscope pictures can either could show an individual layer of stones with a constant (white or black) background or the surface of a random packed pile. Each individual stone has multiple colours. I would like to know exactly what percentage of image is background and what percentage of the actual stone is each individual colour. As the surface is none uniform and a uniform surface cannot be constructed for this application, shadows may be an issue if a mulilayered surface of rock is used. Adjustable tolerances of the colour and feedback as to which sections are labelled as each colour would, therefore, be useful. I will then be able to correlate the results to chemical analysis to determine how the surface composition compares to the total composition.

My hope is that (as this is a relatively simple concept) this is possible using Matlab, Photoshop, or some other readily available piece of software. Freeware is not nessesary but might be preferable so it can be tested before expenditure. If it can be done in Matlab, what is a good resource for learning how to use it for such image analysis?

  • I don't know if if this is important or not but consider that PC does not read colours same as device used to produce photography. Even more if more than one device is used for photography PC could easily produce same colour for different variations of specific colour. So colour calibration may be needed to make sure colours are read properly.
    – danijelc
    Feb 27, 2014 at 13:31
  • By colour calibration you mean that the software would have to have some input where we say "this is colour a, this is b, and this is background" rather than having each colour be preset in the software? Currently only one camera is being used and the regions are easily distinguished by the human eye under the microscope or in the images. I think, therefore, that most of the CIE data can be lost without issue. Currently trying to do this with Matlab results in the inability to distinguish rock from shadows and impixel is used so the user can identify important colours.
    – user984
    Feb 27, 2014 at 14:28

2 Answers 2


I have acheived some success with both ImageJ and Matlab. I would recommend either these to anyone else who needs a simular analysis. While ImageJ is easier to quickly setup a filter and macro to repeat it, Matlab seems more flexible. I have been able to use Matlab to create its own filter based on user identification of the areas. I am using ImageJ for my application, however, as it is freeware and easier for coworkers who wish to replicate my results to obtain.


Another freeware option would be the Python package named Scikit-image (http://scikit-image.org/). It contains plenty of the most used image processing functions (http://scikit-image.org/docs/stable/api/api.html).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.