• The spatial distortion of the structured illumination system is corrected via exploiting the computer vision technique. • Nonlinear responses at each camera pixel are corrected via measuring an intensity lookup table. • All procedure is performed based on image processing; thus, it does not require fine optical alignment. • Any distortion-free structured illumination patterns could be synthesized via the proposed method. Structured illumination, which projects a predefined spatially varying intensity pattern, has been widely used in a variety of applications, including 3D shape estimation, optical property estimation, and super-resolution imaging. The precision of the structured illumination method is determined by the accuracy of the illumination pattern captured by the detector; however, acquiring images of the precise pattern is difficult due to distortion and nonlinear response in the imaging system. We proposed an adaptive pattern synthesis method that could overcome projecting system distortion and the system's nonlinear response. The proposed method consists of four steps: estimation of the geometric transformation matrix between the structured illumination unit and detector, estimation of the detector's intensity lookup table, and synthesis of the corrected patterns. Furthermore, by measuring the 3D printed target and tissue-mimicking phantom, the proposed method demonstrated its ability to improve the accuracy of phase shift profilometry and spatial frequency domain imaging. It does not require fine alignment or optical system details because all procedure is performed by projecting digital patterns and its measurement without calibration targets. The proposed method could be applied to any optical technique that uses structured illumination to improve accuracy and performance, making it useful in both academic and industrial applications.