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 to provide sets of digits; 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; wherein the generating of the sets of digits comprises generating sets of trinary digits; wherein each trinary digit of the set of trinary digits represents a relationship between (a) a first similarity between the patch and a next patch of the set of patches of the next frame; and (b) a second similarity between the patch and a previous patch of the set of patches of the previous frame, wherein the next patch and the previous patch are located at the same location; wherein the generating of sets of trinary digits comprises: assigning a first value to the trinary digit if the first similarity is more significant that the second similarity; assigning a second value to the trinary digit if the second similarity is more significant that the first similarity; and assigning a third value to the trinary digit if the first similarity is equal to the second similarity.