Invariant representations to prepare for content based image retrieval from first principles