12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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<Gray, Byte> Image { get; private set; }
- public EdgeImage(DepthImage depthImage, OutputImage outputImage)
- {
- Image<Gray, byte> 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<Gray, Byte> 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());
- }
- }
- }
|