We present an automated approach to detect and extract information from the astronomical datasets on the shapes of such objects as galaxies, star clusters and, especially, elongated ones such as the gravitational lenses. First, the Kolmogorov stochasticity parameter is used to retrieve the sub-regions that worth further attention. Then we turn to image processing and machine learning Principal Component Analysis algorithm to retrieve the sought objects and reveal the information on their morphologies. We show the capability of our automated method to identify distinct objects, including of and to classify them based on the input parameters. A catalog of possible lensing objects is retrieved as an output of the software, then their inspection is performed for the candidates that survive the filters applied.