Optical pattern recognition with microlasers