This article discusses a method for the automatic segmentation of trans-abdominal ultrasound images of the prostate. Segmentation begins with the application of a filter to enhance the contours without modifying the image information. It combines adaptive morphological filtering and median filtering to detect the noise-containing regions and smooth them. A heuristic optimization algorithm searches for the contour initialized from a prostate model. The performance of the algorithm was tested by comparing the resulting contours with those obtained by manual segmentation. The average distance between the contours was 2.5 mm and the average coverage index was 93%.