Polarization measurements are important for a large range of applications such as ellipsometry, bio-imaging, imaging polarimetry and optical communications. This method enables the use of computer-generated space-variant subwavelength dielectric gratings for the formation of radially and azimuthally polarized light. By correctly determining the direction, period and depth of the grating, any desired continuous polarization can be obtained. Furthermore the continuity of our grating ensures the continuity of the transmitted field, thus suppressing diffraction effects that may rise from discontinuity. Our gratings are compact, lightweight, flexible in design and have high transmission efficiency. The gratings have been used in the laboratory to achieve experimental measurements of polarized and partially polarized CO2 laser radiation at a wavelength of 10.6 μm.