Beispiel #1
0
 /// <summary>
 /// Returns all of the features found within a bitmap.
 /// </summary>
 /// <param name="bitmap">The bitmap to search through.</param>
 /// <returns>All of the features found within the bitmap.</returns>
 public void Match(Prefab.Bitmap bitmap, ICollection <Tree> found)
 {
     for (int row = 0; row < bitmap.Height; row++)
     {
         for (int col = 0; col < bitmap.Width; col++)
         {
             root.GetMatches(bitmap, col, row, found);
         }
     }
 }
Beispiel #2
0
        public void GetMatches(Bitmap bitmap, int probeOffsetX, int probeOffsetY, ICollection <Tree> bucket)
        {
            int imageOffsetX, imageOffsetY;

            imageOffsetX = probeOffsetX + m_offsetToTest.X;
            imageOffsetY = probeOffsetY + m_offsetToTest.Y;
            //Point.Add(probeOffsetX, m_offsetToTest.X, probeOffsetY, m_offsetToTest.Y, out imageOffsetX, out imageOffsetY);

            if (imageOffsetX >= 0 && imageOffsetY >= 0 &&
                imageOffsetY < bitmap.Height && imageOffsetX < bitmap.Width)
            {
                FeatureTreeNode child = null;
                bool            has   = m_childrenByColor.TryGetValue(bitmap[imageOffsetY, imageOffsetX], out child);
                if (has)
                {
                    child.GetMatches(bitmap, probeOffsetX, probeOffsetY, bucket);
                    if (m_transparentChild != null)
                    {
                        m_transparentChild.GetMatches(bitmap, probeOffsetX, probeOffsetY, bucket);
                    }
                    return;
                }
            }
            if (m_transparentChild != null)
            {
                m_transparentChild.GetMatches(bitmap, probeOffsetX, probeOffsetY, bucket);
            }
        }