A many-to-many image matching algorithm