Implementation of a colorimetric algorithm for an image based pH analyser