Surface waves are useful signals in seismic inversions of near-surface elastic properties. However, they are considered as noise in reflection seismology when exploring for hydrocarbons. Detecting and outlining the area of surface waves in seismic gathers facilitates either their inversion for sub-surface structures or their noise removal. We propose an unsupervised machine-learning algorithm to automatically distinguish surface waves in the raw seismic data according to their common features, such as low frequency, low velocity, and high amplitude when compared to body waves. The local attributes of frequency, amplitude, and velocity, which are obtained by Gabor frequency and structure tensor, are used in K-means analyses to detect and outline surface waves on seismic shot gathers. The performance of this new algorithm is evaluated on several datasets, including two synthetic datasets with random noise and missing traces, and a field dataset. In these examples, the algorithm is stable and successfully outlines the surface waves.