Exemplo n.º 1
0
 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;
 }
        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;
        }
Exemplo n.º 3
0
        private void TeachThread(object parameter)
        {
            TeachThreadParameter input = parameter as TeachThreadParameter;

            if (input == null)
            {
                throw new ArgumentNullException("Неправильный параметр потока.");
            }

            var delta = 1.0 / filesToTeach.Count;

            for (int i = input.From; (i < input.To) && (!isTeachingAborted); ++i)
            {
                try
                {
                    var image     = new SimpleImage(imagesToTeach[i]);
                    var imageData = image.GetGrayData();
                    var lbp       = new LBPCreator(imageData, true, true, false);
                    var glcm      = new GLCMCreator(imageData, true, true, false);
                    AddFeatures(glcm.Feature, lbp.Feature, filesToTeach[i]);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    continue;
                }
                finally
                {
                    lock ((knownFiles as ICollection).SyncRoot)
                    {
                        teachProgress += delta;
                    }
                }
            }
            input.CommonBarrier.SignalAndWait();
        }
Exemplo n.º 4
0
        private void TeachThread(object parameter)
        {
            TeachThreadParameter input = parameter as TeachThreadParameter;
            if (input == null)
            {
                throw new ArgumentNullException("Неправильный параметр потока.");
            }

            var delta = 1.0 / filesToTeach.Count;
            for (int i = input.From; (i < input.To) && (!isTeachingAborted); ++i)
            {
                try
                {
                    var image = new SimpleImage(imagesToTeach[i]);
                    var imageData = image.GetGrayData();
                    var lbp = new LBPCreator(imageData, true, true, false);
                    var glcm = new GLCMCreator(imageData, true, true, false);
                    AddFeatures(glcm.Feature, lbp.Feature, filesToTeach[i]);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    continue;
                }
                finally
                {
                    lock ((knownFiles as ICollection).SyncRoot)
                    {
                        teachProgress += delta;
                    }
                }
            }
            input.CommonBarrier.SignalAndWait();
        }