An algorithm for direct birefringence measurements using intensities of digital photoelastic patterns of fibres