Application of statistical modeling of image spatial structures to automated visual inspection of product quality