Automatic surface inspection using wavelet reconstruction