public LBPCreator(ImageGrayData imageData, bool isTeaching, bool isDivideToFragments, bool isMultithread = true)
        {
            var needSize = RecognitionParameters.RecognitionFragmentSize;

            if (isTeaching)
            {
                needSize = RecognitionParameters.FragmentsSize;
            }

            if ((imageData.Width < needSize) ||
                (imageData.Height < needSize))
            {
                throw new ArgumentException("Размер изображения меньше размера фрагмента для разбиения. \n" +
                                            "Невозможно создать LBP-гистограмму");
            }

            fragmentSize             = needSize;
            this.isTeaching          = isTeaching;
            this.isDivideToFragments = isDivideToFragments;
            this.isMultithread       = isMultithread;
            data    = imageData.Data;
            width   = imageData.Width;
            height  = imageData.Height;
            feature = null;
            ConstructFeature();
        }
        public TextureSample(ImageGrayData imageData, bool isDivideToFragments)
        {
            sample = imageData;
            var glcmCreator = new GLCMCreator(sample, false, isDivideToFragments);
            var lbpCreator  = new LBPCreator(sample, false, isDivideToFragments);

            glcm = glcmCreator.Feature;
            lbp  = lbpCreator.Feature;
        }
        private void PrepareData(ImageGrayData imageData)
        {
            width  = imageData.Width;
            height = imageData.Height;
            data   = new byte[width, height];
            var grayData   = imageData.Data;
            int quantizers = 256 / RecognitionParameters.GLCMSize;

            for (int y = 0; y < height; ++y)
            {
                for (int x = 0; x < width; ++x)
                {
                    data[x, y] = (byte)(grayData[x, y] / quantizers);
                }
            }
        }
        public GLCMCreator(ImageGrayData imageData, bool isTeaching, bool isDivideToFragments, bool isMultithread = true)
        {
            var needSize = RecognitionParameters.RecognitionFragmentSize;

            if (isTeaching)
            {
                needSize = RecognitionParameters.FragmentsSize;
            }

            if ((imageData.Width < needSize) ||
                (imageData.Height < needSize))
            {
                throw new ArgumentException("Размер изображения меньше размера фрагмента для разбиения. \n" +
                                            "Невозможно создать матрицу взаимной встречаемости");
            }

            fragmentSize             = needSize;
            this.isTeaching          = isTeaching;
            this.isDivideToFragments = isDivideToFragments;
            this.isMultithread       = isMultithread;
            PrepareData(imageData);
            ConstructFeature();
        }