The invention relates to a method for obtaining contrast agent relaxation time. The method comprises the following steps: automatically identifying a contrast agent sample in an image, precisely positioning a sample center point, and calculating the radius of a sample test tube, automatically selecting ROI (Region of Interest) by the center point of the test tube as the center according to the radius of the test tube, calculating the mean value of a pixel signal in the ROI, and experimenting a standard deviation; and finally, carrying out nonlinear fitting to an automatically-extracted signal, and accurately, quickly and efficiently calculating a spinning-lattice relaxation time T1 value and a spinning-lattice relaxation time T2 value of the contrast agent. A process that a plurality of samples are identified in the image and the ROI of the samples is selected is a computer automation process, an artificial process is omitted, and the positioning accuracy, the ROI shape consistency and the result accuracy of the invention are far better than those of a traditional method. The whole flow from ROI selection and ROI signal extraction to the nonlinear fitting is a fully-automatic process, and the time efficiency of the method is far higher than the time efficiency of the traditional method.