A motion sensor device for measuring a distance to an object, the device comprising: an image sensor; first and second light sources (702, 703); and a controller configured to control the image sensor and the first and second light sources, wherein the controller is further configured to: make the image sensor capture a first frame with light emitted from the first light source at a first time; make the image sensor capture a second frame with light emitted from the second light source at a second time; generate differential data representing a difference between a first image gotten by capturing the first frame and a second image gotten by capturing the second frame; characterized in that the controller is further configured to locate an estimated object area which forms part of the differential data between a point where the difference becomes a local maximum value and a point where the difference becomes a local minimum value and which has a direction corresponding to a direction in which the first and second light sources are arranged; perform masking processing on the entire first and second images but the estimated object area based on the difference between the first and second images; and obtain information about the distance to the object shot in the first and second images based on the first and second images that have been subjected to the masking processing. an image sensor; first and second light sources (702, 703); and a controller configured to control the image sensor and the first and second light sources, wherein the controller is further configured to: make the image sensor capture a first frame with light emitted from the first light source at a first time; make the image sensor capture a second frame with light emitted from the second light source at a second time; generate differential data representing a difference between a first image gotten by capturing the first frame and a second image gotten by capturing the second frame; characterized in that the controller is further configured to locate an estimated object area which forms part of the differential data between a point where the difference becomes a local maximum value and a point where the difference becomes a local minimum value and which has a direction corresponding to a direction in which the first and second light sources are arranged; perform masking processing on the entire first and second images but the estimated object area based on the difference between the first and second images; and obtain information about the distance to the object shot in the first and second images based on the first and second images that have been subjected to the masking processing. make the image sensor capture a first frame with light emitted from the first light source at a first time; make the image sensor capture a second frame with light emitted from the second light source at a second time; generate differential data representing a difference between a first image gotten by capturing the first frame and a second image gotten by capturing the second frame; characterized in that the controller is further configured to locate an estimated object area which forms part of the differential data between a point where the difference becomes a local maximum value and a point where the difference becomes a local minimum value and which has a direction corresponding to a direction in which the first and second light sources are arranged; perform masking processing on the entire first and second images but the estimated object area based on the difference between the first and second images; and obtain information about the distance to the object shot in the first and second images based on the first and second images that have been subjected to the masking processing.