Пример #1
0
        /// <summary>
        /// Constructor, default initializes images to 0.0
        /// </summary>
        /// <param name="width">Width of image in pixels</param>
        /// <param name="height">Height of image in pixels</param>
        public DefinitionImage(int width, int height)
        {
            m_width  = width;
            m_height = height;

            m_image          = new Image(m_width, m_height, 0.0);
            m_polar          = new PolarImage(m_width, m_width, 0.0);
            m_imageTransform = new TransformImage(m_width, m_height, 0.0);
            m_polarTransform = new TransformImage(m_width, m_height, 0.0);
        }
Пример #2
0
        public DefinitionImage(int width, int height, Substrokes substrokes, List <DefinitionImage> matches)
        {
            /* Note: this constructor is a special case, which does not normalize the values.
             * This constructor is important, as it is called in addDefinition(Substroke[] substrokes).
             * If we made this constructor more generic, we would crash with a stack overflow.
             *
             * ie. We cannot simple do this:
             * addDefinition(substrokes);
             */

            m_width  = width;
            m_height = height;

            m_image          = new Image(m_width, m_height, substrokes);
            m_polar          = new PolarImage(m_width, m_height, substrokes);
            m_imageTransform = new TransformImage(m_image);
            m_polarTransform = new TransformImage(m_polar);

            int len = matches.Count;

            //Find the rotated image for each
            if (len > 0)
            {
                double[] angles;
                m_polar.findTranslations(matches, out angles);

                m_rotatedImages = new Image[len];

                int        i;
                Substrokes temp;
                for (i = 0; i < len; ++i)
                {
                    temp = substrokes.rotateClone(angles[i]);
                    m_rotatedImages[i] = new Image(m_width, m_height, temp);
                }
            }
        }