Automated algorithm for the nondestructive detection of subsurface cavities by the IR-CAT method