protected override void BeforeProcess()
        {
            _lcArgs = _arg as LevelColorArg;
            if (_isFirstCount)
            {
                _lcArgs.ObjPixelCount.ClearPixelCount();
                CountHistPixel();
                _isFirstCount = false;
            }

            _inputMid  = _lcArgs.InputMiddle;
            _outputMin = _lcArgs.OutputMin;

            int    outputDif = _lcArgs.OutputMax - _outputMin;
            double inputDif  = _lcArgs.InputMax - _lcArgs.InputMin;
            double thanValue = _lcArgs.InputMin / inputDif;

            _rgbs = new byte[256];
            if (_lcArgs.IsChanged)
            {
                for (int i = 0; i < 256; i++)
                {
                    _rgbs[i] = ColorMath.FixByte(outputDif * Math.Pow((i / inputDif - thanValue), _inputMid) + _outputMin);
                }
            }
            else
            {
                for (int i = 0; i < 256; i++)
                {
                    _rgbs[i] = (byte)i;
                }
            }
        }
 public override XmlElement ToXML(XmlDocument xmldoc)
 {
     if (_lcArgs == null)
     {
         _lcArgs = new LevelColorArg();
     }
     return(_lcArgs.ToXML(xmldoc));
 }
Exemple #3
0
        public override RgbProcessorArg Clone()
        {
            LevelColorArg arg = new LevelColorArg(_channel);

            arg.Channel       = _channel;
            arg.InputMin      = _inputMin;
            arg.InputMiddle   = _inputMiddle;
            arg.InputMax      = _inputMax;
            arg.OutputMin     = _outputMin;
            arg.OutputMax     = _outputMax;
            arg.ObjPixelCount = _objPixelCount;
            return(arg);
        }
 public override void CreateDefaultArguments()
 {
     _arg = new LevelColorArg();
 }