コード例 #1
0
 internal TransitionMatrices(StatesValues statesValues)
 {
     _statesValues = statesValues;
     _statesCount  = statesValues.StateCount;
     InitializeInitialMatrix();
     InitializeTransitionMatrices();
 }
コード例 #2
0
 internal IamgeRMP(StatesValues statesValues, Bitmap bitmap)
 {
     Initialize();
     _statesValues      = statesValues;
     _bmpOriginal       = bitmap;
     TransitionMatrices = new TransitionMatrices(statesValues);
     ProceedReal();
 }
コード例 #3
0
 internal IamgeRMP(StatesValues statesValues, TransitionMatrices transitionMatrices)
 {
     Initialize();
     _statesValues       = statesValues;
     _transitionMatrices = transitionMatrices;
     Image = new Bitmap(_transitionMatrices.Width, _transitionMatrices.Height);
     TransitionMatrices = new TransitionMatrices(statesValues);
     ProceedArtificial();
 }
コード例 #4
0
        public int GetMaxStateCount(string path)
        {
            SetStatus?.Invoke("Расчёт макимального количества состояний...");

            var bmp         = new Bitmap(path);
            var stateValues = new List <StateValue>();

            int index = 0, maxStates = 20000;

            var total = bmp.Width * bmp.Height;
            var mid   = total / 2;
            var end   = total + mid;

            var values = new int[maxStates];

            for (int xy = mid; xy < end; xy++)
            {
                var y = xy / bmp.Height % bmp.Height;
                var x = (xy - y * bmp.Width) % bmp.Width;

                var pixel = bmp.GetPixel(x, y);
                var val   = StatesValues.GetColorValue(pixel);
                if (!values.Contains(val))
                {
                    values[index] = val;
                    stateValues.Add(new StateValue(index++, val, pixel));
                }
                if (maxStates == index)
                {
                    break;
                }
            }

            _statesValues = new StatesValues(stateValues);

            SetStatus?.Invoke("Максимальное количество состояний: " + stateValues.Count.ToString());

            return(stateValues.Count);
        }