private void GetImageDetailsFromTree(BinaryNode node) { if (node.IsLeaf()) { imageInformation.Add(new ImageDetails(node.image, node.coordinates, node.size)); } }
/// <summary> /// Assign inner nodes a 'Vertical' or 'Horizontal' split at random (50/50 chance) /// </summary> private void SetNodeSplit(BinaryNode node) { if (!node.IsLeaf()) { if (node.assignedSplit == Split.None) { node.assignedSplit = GetRandomSplit(); } } }
/// <summary> /// Assign images and aspect ratios to all leaf nodes /// </summary> private void SetImageToLeafNode(BinaryNode node) { if (node.IsLeaf()) { if (numImagesAssignedToNodes < images.Count) { Image image = images[numImagesAssignedToNodes++]; node.image = image; node.aspectRatio = (float)image.Width / (float)image.Height; } } }