For patients with myocardial infarction (MI), delayed enhancement (DE) cardiovascular magnetic resonance imaging (MRI) is a sensitive and well-validated technique for the detection and visualization of MI. The myocardium viability assessment with DE MRI is important in diagnosis and treatment management, where myocardium segmentation is a prerequisite. However, few academic works have focused on automated myocardium segmentation from DE images. In this study, we aim to develop an automatic myocardium segmentation algorithm that targets DE images. We propose a segmentation framework based on both prior shape knowledge and image intensity. Instead of the strong request of the pre-segmentation of cine MRI in the same session, we use the sparse representation method to model the myocardium shape. Data from the Cardiac MR Left Ventricle Segmentation Challenge (2009) are used to build the shape template repository. The method of guided random walks is used to integrate the shape model and intensity information. An iterative approach is used to gradually improve the results. The proposed method was tested on the DE MRI data from 30 MI patients. The proposed method achieved Dice similarity coefficients (DSC) of 74.60 ± 7.79% with 201 shape templates and 73.56 ± 6.32% with 56 shape templates, which were close to the inter-observer difference (73.94 ± 5.12%). To test the generalization of the proposed method to routine clinical images, the DE images of 10 successive new patients were collected, which were unseen during the method development and parameter tuning, and a DSC of 76.02 ± 7.43% was achieved. The authors propose a novel approach for the segmentation of myocardium from DE MRI by using the sparse representation-based shape model and guided random walks. The sparse representation method effectively models the prior shape with a small number of shape templates, and the proposed method has the potential to achieve clinically relevant results.