Smart camera with pattern matching