Optical inspection with counting and cruise control