Multi-photon fluorescence microscopy (MFM) captures high-resolution anatomical and functional fluorescence image sequences and can be used for the intact brain imaging of small animals. Recently, it has been extended from imaging anesthetized and head-stabilized animals to awake and head-restrained ones forin vivo neurological study. In these applications, motion correction is an important pre-processing step since brain pulsation and tiny body movement can cause motion artifacts and prevent stable serial image acquisition at such a high spatial resolution. This paper proposes a speed embedded hidden Markov model (SEHMM) for motion correction in MFM imaging of awake head-restrained mice. The algorithm extends the traditional HMM method by embedding a motion prediction model to better estimate the state transition probability. SEHMM is a line-by-line motion correction algorithm, which is implemented within the in-focal-plane 2-D videos and can operate directly on the motion-distorted imaging data without external signal measurements such as the movement, heartbeat, respiration, or muscular tension. In experiments, we demonstrat that SEHMM is more accurate than traditional HMM using both simulated and real MFM image sequences.