Intelligent anti-shake control