A compensation technique for reducing the effect of nonlinear optical frequency swept in an optical frequency-domain reflectometer (OFDR) is proposed. The instantaneous sweep optical frequency of an OFDR laser source is directly obtained by analysis of the interference signal from an auxiliary interferometer with a Hilbert transformation. Beating OFDR data from a main interferometer are regenerated with respect to the measured instantaneous optical frequency. We show that this technique dramatically improves the spatial resolution of a conventional OFDR and can be applied to an optical frequency-domain medical imaging system to eliminate the problem of a nonlinear frequency sweep effect.