A patch memory system for image processing and computer vision