Exemplo n.º 1
0
		public void SetForeground(Tree node, Bitmap image, Bitmap foreground) {

			Ptype ptype = (Ptype)node["ptype"];
			Region interiorregion = ptype.Region("interior");

			foreground.WriteBlock(Utils.BACKGROUND, node);

			if (interiorregion != null)
			{
				IBoundingBox interior = GetInteriorBox(node, ptype);

				int top = interior.Top;
				int left = interior.Left;
				int leftdepth = ptype.Region("left").Bitmap.Width;

				int bottom = interior.Top + interior.Height;
				int right = interior.Left + interior.Width;

				for(int row = top; row < bottom; row++)
				{
					for (int col = left; col < right; col++)
					{
						int backgroundValue = interiorregion.Bitmap[(row - top) % interiorregion.Bitmap.Height,
							(col - node.Left - leftdepth) % interiorregion.Bitmap.Width];

						if (backgroundValue != image[row, col])
							foreground[row, col] = node.GetHashCode();
					}
				}

				//We looked at the features and might have counted them as foreground.
				EraseFeaturesFromforeground(foreground, node, ptype);
			}
		}
Exemplo n.º 2
0
		public void SetForeground(Tree node, Bitmap image, Bitmap foreground)
		{
			foreground.WriteBlock(Utils.BACKGROUND, node);
		}