We introduce the histogram of oriented gradients (HOG), a tool developed for machine vision that we propose as a new metric for the systematic characterization of observations of atomic and molecular gas and the study of molecular cloud formation models. In essence, the HOG technique takes as input extended spectral-line observations from two tracers and provides an estimate of their spatial correlation across velocity channels. We characterize HOG using synthetic observations of HI and $^{13}$CO(J=1-0) emission from numerical simulations of MHD turbulence leading to the formation of molecular gas after the collision of two atomic clouds. We find a significant spatial correlation between the two tracers in velocity channels where $v_{HI}approx v_{^{13}CO}$, independent of the orientation of the collision with respect to the line of sight. We use HOG to investigate the spatial correlation of the HI, from the THOR survey, and the $^{13}$CO(J=1-0) emission, from the GRS, toward the portion of the Galactic plane 33.75$lt llt$35.25$^{o}$ and $|b|lt$1.25$^{o}$. We find a significant spatial correlation between the tracers in extended portions of the studied region. Although some of the regions with high spatial correlation are associated with HI self-absorption features, suggesting that it is produced by the cold atomic gas, the correlation is not exclusive to this kind of region. The HOG results also indicate significant differences between individual regions: some show spatial correlation in channels around $v_{HI}approx v_{^{13}CO}$ while others present this correlation in velocity channels separated by a few km/s. We associate these velocity offsets to the effect of feedback and to the presence of physical conditions that are not included in the atomic-cloud-collision simulations, such as more general magnetic field configurations, shear, and global gas infall.