A displacement sensor comprising an imaging unit and an 
image processing unit. The imaging unit comprises a 
two dimensional imaging device and a drive 
control unit. The 
two dimensional imaging device includes a group of light receiving pixels arranged in a matrix so as to correspond to a 
field of view of a standard imaging unit, a plurality of 
vertical shift registers corresponding to different columns of the pixels, and a horizontal register for receiving the outputs of the 
vertical shift registers from top stages thereof, a photosensitive pixel region being defined in a prescribed horizontal band having a sufficiently narrower width than that would be provided by the total number of horizontal lines and interposed between a front optically black pixel region and a back optically black pixel region. The drive 
control unit controls, according to a commanded 
electric charge transfer protocol, a feeding of 
signal electric charges from each light receiving pixel to the 
vertical shift register of a corresponding column, a 
vertical transfer of 
signal electric charges in the vertical 
shift register of each column, and a horizontal transfer of 
signal electric charges in the horizontal 
shift register. The 
image processing unit comprises 
electric charge transfer protocol command means for giving an 
electric charge transfer protocol to the drive 
control unit of the imaging unit in dependence of a content of the image process.