Sensor to scan 2d surface

Take a photo and process it with Matlab on a PC. Here is a tutorial with rice grains.