using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using Emgu.CV; using Emgu.CV.Structure; using bbiwarg.Detectors.Fingers; using System.Diagnostics; using bbiwarg.Utility; using bbiwarg.Graphics; namespace bbiwarg.Images { class EdgeImage { public Image Image { get; private set; } public EdgeImage(DepthImage depthImage, OutputImage outputImage) { Image dimg = depthImage.Image * (255.0f / (float)(depthImage.MaxDepth - depthImage.MinDepth)); Image = dimg.Canny(100, 75, 3); // draw blue edges in outputImage outputImage.Image[2] = Image.ThresholdBinary(new Gray(0), new Gray(1)).Mul(255); } public EdgeImage(Image edgeImage) { Image = edgeImage; } public bool isEdgeAt(Point point) { return isEdgeAt(point.X, point.Y); } public bool isEdgeAt(int x, int y) { return (Image.Data[y, x, 0] > 0); } public void removeFingerEdges(Finger finger) { Point[] polygon = finger.getPolygon(); Image.FillConvexPoly(polygon, new Gray(0)); } public EdgeImage copy() { return new EdgeImage(Image.Copy()); } } }