1. A method for motion detection, the method comprises: receiving multiple frames; generating a set of digits for each pixel of multiple pixels of each frame of the multiple frames; wherein each set of digits represents a pixel that belongs to a patch of a frame and represents relationships between (a) first similarities between the patch and a set of patches of a next frame that are located in locations that differ from each other and differ from a location of the patch; and (b) second similarities between the patch and a set of patches of a previous frame that are located in locations that differ from each other and differ from a location of the patch; and processing the sets of digits to detect motion.