Browse Source

documented Images

Daniel Kauth 10 years ago
parent
commit
728439508a
3 changed files with 134 additions and 2 deletions
  1. 19 0
      bbiwarg/Images/ConfidenceImage.cs
  2. 52 1
      bbiwarg/Images/DepthImage.cs
  3. 63 1
      bbiwarg/Images/EdgeImage.cs

+ 19 - 0
bbiwarg/Images/ConfidenceImage.cs

@@ -11,12 +11,31 @@ using bbiwarg.Utility;
 
 namespace bbiwarg.Images
 {
+    /// <summary>
+    /// ConfidenceImage stores the raw confidence data read from the Camera as an <see cref="Image"/>.
+    /// </summary>
     public class ConfidenceImage
     {
+        /// <summary>
+        /// the size of the confidence image
+        /// </summary>
         public ImageSize Size { get; private set; }
+
+        /// <summary>
+        /// the confidence image
+        /// </summary>
         public Image<Gray, Int16> Image { get; private set; }
+
+        /// <summary>
+        /// a mask image, which is 1 iff the the confidence value is greater than <see cref="Parameters.ConfidenceImageMinThreshold"/>
+        /// </summary>
         public Image<Gray, byte> Mask { get; private set; }
 
+        /// <summary>
+        /// Constructs a new ConfidenceImage using the specified data and size.
+        /// </summary>
+        /// <param name="rawConfidenceData">pointer to raw confidence data</param>
+        /// <param name="size">size of the confidence image</param>
         public ConfidenceImage(IntPtr rawConfidenceData, ImageSize size)
         {
             Size = size;

+ 52 - 1
bbiwarg/Images/DepthImage.cs

@@ -14,14 +14,38 @@ using bbiwarg.Utility;
 
 namespace bbiwarg.Images
 {
+    /// <summary>
+    /// DepthImage stores a processed version of the depth image read by the camera as an <see cref="Image"/>
+    /// </summary>
     public class DepthImage
     {
+        /// <summary>
+        /// image size of the deph image
+        /// </summary>
         public ImageSize Size { get; private set; }
+
+        /// <summary>
+        /// the processed depth image
+        /// </summary>
         public Image<Gray, byte> Image { get; private set; }
-        public Image<Gray, byte> BackgroundMask { get; private set; }
+
+        /// <summary>
+        /// the minimum depth in the raw depth image
+        /// </summary>
         public Int16 MinDepth { get; private set; }
+
+        /// <summary>
+        /// the maximum depth which is considered important
+        /// </summary>
         public Int16 MaxDepth { get; private set; }
 
+        /// <summary>
+        /// Construct a DepthImage from the raw depth data, the image size and a confidenceImage.
+        /// Filters the image using confidenceImage and also thresholds and smoothes it.
+        /// </summary>
+        /// <param name="rawDepthData">the raw depth data</param>
+        /// <param name="size">the image size</param>
+        /// <param name="confidenceImage">the confidence image</param>
         public DepthImage(IntPtr rawDepthData, ImageSize size, ConfidenceImage confidenceImage)
         {
             Size = size;
@@ -44,26 +68,53 @@ namespace bbiwarg.Images
             Image = Image.SmoothMedian(Parameters.DepthImageMedianSize);
         }
 
+        /// <summary>
+        /// Returns the depth in the processed image at a given point.
+        /// </summary>
+        /// <param name="point">the point</param>
+        /// <returns>depth at the point</returns>
         public Int16 getDepthAt(Point point)
         {
             return getDepthAt(point.X, point.Y);
         }
 
+        /// <summary>
+        /// Returns the depth in the processed image at a given position.
+        /// </summary>
+        /// <param name="x">x coordinate of the position</param>
+        /// <param name="y">y coordinate of the position</param>
+        /// <returns>the depth at the position</returns>
         public Int16 getDepthAt(int x, int y)
         {
             return (Int16)(MinDepth + Image.Data[y, x, 0]);
         }
 
+        /// <summary>
+        /// Sets the depth in the processed image.
+        /// </summary>
+        /// <param name="point">point where the depth is set</param>
+        /// <param name="depth">new depth value</param>
         public void setDepthAt(Point point, Int16 depth)
         {
             setDepthAt(point.X, point.Y, depth);
         }
 
+        /// <summary>
+        /// Sets the depth in the processed image.
+        /// </summary>
+        /// <param name="x">x coordinate of position to set depth</param>
+        /// <param name="y">y coordinate of position to set depth</param>
+        /// <param name="depth">new depth value</param>
         public void setDepthAt(int x, int y, Int16 depth)
         {
             Image.Data[y, x, 0] = (byte)(depth - MinDepth);
         }
 
+        /// <summary>
+        /// Returns the minimum depth in an <see cref="Image"/>
+        /// </summary>
+        /// <param name="image">the image</param>
+        /// <returns>the minimum depth</returns>
         private Int16 findMinDepth(Image<Gray, Int16> image)
         {
             // min and max values

+ 63 - 1
bbiwarg/Images/EdgeImage.cs

@@ -6,12 +6,30 @@ using System.Drawing;
 
 namespace bbiwarg.Images
 {
+    /// <summary>
+    /// EdgeImage creates an edge image form a depth image and stores it as an <see cref="Image"/>
+    /// </summary>
     public class EdgeImage
     {
+        /// <summary>
+        /// the size of the edge image
+        /// </summary>
         public ImageSize Size { get; private set; }
+
+        /// <summary>
+        /// the edge image
+        /// </summary>
         public Image<Gray, Byte> Image { get; private set; }
-        public Image<Gray, byte> RoughImage { get; private set; }
 
+        /// <summary>
+        /// dilated version of the edge image
+        /// </summary>
+        public Image<Gray, Byte> RoughImage { get; private set; }
+
+        /// <summary>
+        /// Constructs a new EdgeImage from a depth image.
+        /// </summary>
+        /// <param name="depthImage">the depth image</param>
         public EdgeImage(DepthImage depthImage)
         {
             Size = depthImage.Size;
@@ -19,6 +37,12 @@ namespace bbiwarg.Images
             RoughImage = Image.Dilate(Parameters.EdgeImageRoughNumDilationIterations);
         }
 
+        /// <summary>
+        /// Creates a new EdgeImage from the data of another edge image.
+        /// </summary>
+        /// <param name="edgeImage">the edge image</param>
+        /// <param name="roughEdgeImage">dilated version of the edge image</param>
+        /// <param name="size">size of the dege image</param>
         public EdgeImage(Image<Gray, Byte> edgeImage, Image<Gray, Byte> roughEdgeImage, ImageSize size)
         {
             Size = size;
@@ -26,32 +50,66 @@ namespace bbiwarg.Images
             RoughImage = roughEdgeImage;
         }
 
+        /// <summary>
+        /// Returns true iff an edge is at a point.
+        /// </summary>
+        /// <param name="point">the point</param>
+        /// <returns>true iff an edge is at point</returns>
         public bool isEdgeAt(Point point)
         {
             return isEdgeAt(point.X, point.Y);
         }
 
+        /// <summary>
+        /// Returns true iff an edge is at a position.
+        /// </summary>
+        /// <param name="x">x coordinate of the position</param>
+        /// <param name="y">y coordinate of the position</param>
+        /// <returns>true iff an edge is at the position</returns>
         public bool isEdgeAt(int x, int y)
         {
             return (Image.Data[y, x, 0] > 0);
         }
 
+        /// <summary>
+        /// Returns true iff an edge is at a point in the rough edge image.
+        /// </summary>
+        /// <param name="point">the point</param>
+        /// <returns>true iff an edge is at point in the rough edge image</returns>
         public bool isRoughEdgeAt(Point point)
         {
             return isRoughEdgeAt(point.X, point.Y);
         }
 
+        /// <summary>
+        /// Returns true iff an edge is at a position in the rough edge image.
+        /// </summary>
+        /// <param name="x">x coordinate of the position</param>
+        /// <param name="y">y coordinate of the position</param>
+        /// <returns>true iff an edge is at the position in the rough edge image</returns>
         public bool isRoughEdgeAt(int x, int y)
         {
             return (RoughImage.Data[y, x, 0] > 0);
         }
 
+        /// <summary>
+        /// Removes all edges inside the given polygon in both edge images.
+        /// </summary>
+        /// <param name="polygon">the polygon</param>
         public void removeEdgesInsidePolygon(Point[] polygon)
         {
             Image.FillConvexPoly(polygon, new Gray(0));
             RoughImage.FillConvexPoly(polygon, new Gray(0));
         }
 
+        /// <summary>
+        /// Returns the first vector starting at start and going in the given direction, which rounds to a point containing an edge in the rough edge image
+        /// or null if no such vector is found.
+        /// </summary>
+        /// <param name="start">start position</param>
+        /// <param name="direction">search direction</param>
+        /// <param name="maxSearchSize">maximum number of steps in direction</param>
+        /// <returns></returns>
         public Vector2D findNextRoughEdge(Vector2D start, Vector2D direction, int maxSearchSize = 0)
         {
             Vector2D maxGrow = (Size.MaxPixel - start) / direction;
@@ -90,6 +148,10 @@ namespace bbiwarg.Images
             return null;
         }
 
+        /// <summary>
+        /// Returns a copy of this edge image.
+        /// </summary>
+        /// <returns>copy of this edge image</returns>
         public EdgeImage copy()
         {
             return new EdgeImage(Image.Copy(), RoughImage.Copy(), Size);