/// <summary>
        /// Copy the object.
        /// </summary>
        /// <param name="src">The copy is placed in this parameter.</param>
        public override void Copy(OptionalParameter src)
        {
            base.Copy(src);

            if (src is NoiseParameter)
            {
                NoiseParameter p = (NoiseParameter)src;
                m_fProb = p.prob;
            }
        }
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static new NoiseParameter FromProto(RawProto rp)
        {
            NoiseParameter p = new NoiseParameter(false);
            string         strVal;

            RawProto rpOption = rp.FindChild("option");

            if (rpOption != null)
            {
                ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption));
            }

            if ((strVal = rp.FindValue("prob")) != null)
            {
                p.prob = BaseParameter.ParseFloat(strVal);
            }

            if ((strVal = rp.FindValue("hist_eq")) != null)
            {
                p.hist_eq = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("inverse")) != null)
            {
                p.inverse = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("decolorize")) != null)
            {
                p.decolorize = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("gauss_blur")) != null)
            {
                p.gauss_blur = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("jpeg")) != null)
            {
                p.jpeg = BaseParameter.ParseFloat(strVal);
            }

            if ((strVal = rp.FindValue("posterize")) != null)
            {
                p.posterize = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("erode")) != null)
            {
                p.erode = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("saltpepper")) != null)
            {
                p.saltpepper = bool.Parse(strVal);
            }

            RawProto rp1 = rp.FindChild("saltpepper_param");

            if (rp1 != null)
            {
                p.saltpepper_param = SaltPepperParameter.FromProto(rp1);
            }

            if ((strVal = rp.FindValue("clahe")) != null)
            {
                p.clahe = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("convert_to_hsv")) != null)
            {
                p.convert_to_hsv = bool.Parse(strVal);
            }

            if ((strVal = rp.FindValue("convert_to_lab")) != null)
            {
                p.convert_to_lab = bool.Parse(strVal);
            }

            return(p);
        }
Exemple #3
0
 /// <summary>
 /// Copy the object.
 /// </summary>
 /// <param name="src">The copy is placed in this parameter.</param>
 public void Copy(NoiseParameter src)
 {
     m_fProb = src.prob;
 }