1234567891011121314151617181920212223242526272829303132 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Emgu.CV;
- using Emgu.CV.Structure;
- namespace bbiwarg.Images
- {
- class EdgeImage
- {
- private Image<Gray, Byte> image;
- public EdgeImage(DepthImage depthImage) {
- int minDepth = depthImage.getMinDepth();
- int maxDepth = depthImage.getMaxDepth();
- Image<Gray, Int16> depthImageInt16 = depthImage.getImage();
- Image<Gray, Byte> depthImageByte = depthImageInt16.Convert<Byte>(delegate(Int16 depth) { return (byte)(((depth - minDepth) * Byte.MaxValue) / (maxDepth - minDepth)); });
- image = depthImageByte.Canny(100, 75, 3);
- }
- public bool isEdgeAt(int x, int y) {
- return (image.Data[y,x,0] > 0);
- }
- public Image<Gray, Byte> getImage()
- {
- return image;
- }
- }
- }
|