Запис е-пошти: Classification of objects in images with distortions based on a two-stage topological analysis