Pattern analysis and applications