Aiming at the linear temperature compensation algorithm’s disadvantage of temperature measurement error in rotary kiln infrared scanning temperature measurement process, this paper proposes a precise nonlinear cubic polynomial fitting temperature compensation algorithm. The proposed algorithm compensates the temperature values of scanning points on rotary kiln surface by following steps: Calculating temperature difference between the real temperature value of rotary kiln and temperature value measured by infrared scanning temperature measurement system; Fitting the temperature difference data with cubic polynomial; Using the obtained function to compensate temperature. Experimental result shows that compared with the usual linear temperature compensation algorithm, the accuracy of proposed algorithm has raised about 2.25 times when cubic polynomial is used.