Automatic measurement of stomatal density from microphotographs