The present work focuses on an algorithm for obtaining data on the positions of the centers of gravity of subimages of sunspots from the Shack–Hartmann sensor measurements. The analysis of the positions of the centers of gravity of subimages formed by spaced subapertures is used in determining the verical profiles of optical turbulence and, specifically, the structural constant of turbulent fluctuations of the air refractive index C2n . The characteristics of optical turbulence determine the quality of astronomical images obtained on ground-based telescopes.