During ultrasound diagnosis in clinics, clinicians often mark the lesion area, resulting in the presence of unnecessary objects in the collected ultrasound images. These markers potentially affect subsequent image analysis. To address this problem, we proposed an image inpainting method that combines image processing with Mumford-Shah algorithm to remove markers from ultrasound images. The proposed method consists of two parts. First, the input ultrasound images were processed by several image processing algorithms, including contrast enhancement, image binarization, edge detection, hole filling, and connected domain marking. These algorithms were combined to extract the mask of the manual marker in the ultrasound images. Second, the original ultrasound images and mask images were put into the Mumford-Shah model to implement ultrasound image inpainting by minimizing the following energy functional. The continuous iteration of Euler-Lagrange equation was employed to update the iteration item. If the difference between the two output results was less than the pre-set threshold, the output result could be regarded as the repaired ultrasound image. Experimental results show that the designed image processing method accurately extracted the binary mask, whether they are colourful or binary, number or line in ultrasound images. Meanwhile, the improved Mumford-Shah model effectively implemented the ultrasound image inpainting, with the accuracy of 96.55%. Therefore, the proposed method can be used to remove unnecessary objects in ultrasound images, which is beneficial to improve the accuracy of the artificial intelligence model.