Exemplo n.º 1
0
        public FeaturesLayer(ref Task task)
        {
            _disposed = false;
            // copy task
            _task = new Task(task);
            // init results struct
            _res = new Results();

            _numRunningFeat = 0;
            // features vars
            _bitExactThread = null;
            _bitExact = null;
            _badContrast = null;
            _badContrastThread = null;
            // ---------------
            // set status to 0
            _loadingImagesStatus = 0;
            _runStatus = 0;
            // allocate memory for ImageInfo array
            _images = new ImageInfo[task.ImagePathes.Count];
            for(int i=0; i<_images.Length; i++)
                _images[i] = null;
            // this will run loading images from run()
            _loadingImagesThread = null;
        }
Exemplo n.º 2
0
        public void TestBadContrast()
        {
            int numImages = pathes.Length;
            ImageInfo[] images = new ImageInfo[numImages];
            for (int i = 0; i < numImages; i++)
            {
                images[i] = new ImageInfo(pathes[i]);
            }

            BadContrast bc;
            bc = new BadContrast(images);
            bc.run();
        }
Exemplo n.º 3
0
 /// <summary>
 /// will update RunStatus and on completion, will collect results
 /// </summary>
 /// <returns></returns>
 private int updateRunStatus()
 {
     int currStatus = 0;
     if (_bitExact != null)
     {
         currStatus += _bitExact.RunStatus/_numRunningFeat;
         if (_bitExact.RunStatus == 100)
         {
             _res.setBitExact(_bitExact.Results);
             _bitExact = null;
             _bitExactThread = null;
         }
     }
     if (_badContrast != null)
     {
         currStatus += _badContrast.RunStatus / _numRunningFeat;
         if (_badContrast.RunStatus == 100)
         {
             _res.setBadContrast(_badContrast.Results);
             _badContrast = null;
             _badContrastThread = null;
         }
     }
     _runStatus = System.Math.Max(currStatus, _runStatus);
     return _runStatus;
 }
Exemplo n.º 4
0
 private void runFeatures()
 {
     if (_task.Features[(int)Feature.BIT_EXACT])
     {
         _bitExact = new BitExact(_images);
         _bitExactThread = new Thread(_bitExact.run);
         _bitExactThread.Name = "bitExact";
         _bitExactThread.Start();
         _numRunningFeat++;
     }
     if (_bitExactThread != null)
         _bitExactThread.Join();
     if (_task.Features[(int)Feature.BAD_CONTRAST])
     {
         _badContrast = new BadContrast(_images);
         _badContrastThread = new Thread(_badContrast.run);
         _badContrastThread.Start();
         _numRunningFeat++;
     }
 }