A new method, which can be considered as a calibration technique to transform the measured raw S-parameters of a rectangular waveguide partially filled with a dielectric material into the desired reference planes, is presented. The method is based on the removal of errors arising from the multiple reflections and imperfections of the system elements such as adapters and connectors, through the T-parameter matrix representation of the system. The measured raw data are transformed into the terminal planes of the waveguide by simply calculating frequency-dependent complex coefficients. After this transformation, a quite satisfactory match is observed between the experimentally measured and numerically calculated S-parameters for different types of materials and configurations. The calibrated measured data are also used in the inverse problem to determine the dielectric permittivity of the materials, and the preliminary reconstruction results are very promising.