Пример #1
0
/*
 *          /// <summary>
 *          /// Adds a pixel to the Silhouette descriptor.
 *          /// </summary>
 *          /// <param name="pixels">The collection of pixels to add </param>
 *          protected internal void AddParticipatingPixelsSilhouette(Pixel[] pixels)
 *          {
 *              for (int t = 0; t < pixels.Length; t++)
 *              {
 *                  _xMedianSilhouette += pixels[t].X;
 *                  _yMedianSilhouette += pixels[t].Y;
 *                  _weightSilhouette += 1.0f;
 *
 *                  // compute color average
 *                  IColor colorSilhouette = _silhouetteColorAverage;
 *                  colorSilhouette.ExtendedAlpha += pixels[t].Color.ExtendedAlpha;
 *                  colorSilhouette.ExtendedRed += pixels[t].Color.ExtendedRed;
 *                  colorSilhouette.ExtendedGreen += pixels[t].Color.ExtendedGreen;
 *                  colorSilhouette.ExtendedBlue += pixels[t].Color.ExtendedBlue;
 *              }
 *          }
 */
        #endregion Interfaces implementation

        #region Constructors
        /// <summary>
        /// Create a new instance of this type
        /// </summary>
        protected MomentDescriptorBase() : base()
        {
            DescriptorDependentObjects.Add("silhouette", new DescriptorSquareMatrix());
            DescriptorDependentObjects.Add("shape", new DescriptorSquareMatrix());
            DescriptorDependentObjects.Add("texture", new DescriptorSquareMatrix());
            DescriptorDependentObjects.Add("shapecoloraverage", new ColorDouble());
            DescriptorDependentObjects.Add("silhouettecoloraverage", new ColorDouble());
        }
Пример #2
0
        /// <summary>
        /// Create a new instance of this type -- constructor defined for serializatiom
        /// </summary>
        /// <param name="info">The SerializationInfo member</param>
        /// <param name="context">The StreamingContext member</param>
        protected MomentDescriptorBase(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            xMin              = (int)info.GetInt32("xMin");
            yMin              = (int)info.GetInt32("yMin");
            xMax              = (int)info.GetInt32("xMax");
            yMax              = (int)info.GetInt32("yMax");
            xMedian           = (float)info.GetDouble("xMedian");
            yMedian           = (float)info.GetDouble("yMedian");
            xMedianSilhouette = (float)info.GetDouble("xMedianSilhouette");
            yMedianSilhouette = (float)info.GetDouble("yMedianSilhouette");
            DescriptorSquareMatrix silhouette             = (DescriptorSquareMatrix)info.GetValue("Silhouette", typeof(DescriptorSquareMatrix));
            DescriptorSquareMatrix shape                  = (DescriptorSquareMatrix)info.GetValue("Shape", typeof(DescriptorSquareMatrix));
            DescriptorSquareMatrix texture                = (DescriptorSquareMatrix)info.GetValue("Texture", typeof(DescriptorSquareMatrix));
            ColorDouble            shapeColorAverage      = (ColorDouble)info.GetValue("ShapeColorAverage", typeof(ColorDouble));
            ColorDouble            silhouetteColorAverage = (ColorDouble)info.GetValue("SilhouetteColorAverage", typeof(ColorDouble));

            DescriptorDependentObjects.Add("silhouette", silhouette);
            DescriptorDependentObjects.Add("shape", shape);
            DescriptorDependentObjects.Add("texture", texture);
            DescriptorDependentObjects.Add("shapecoloraverage", shapeColorAverage);
            DescriptorDependentObjects.Add("silhouettecoloraverage", silhouetteColorAverage);
        }