private Edges DetectEdges(byte *data, int width, int height, byte edgeColor, float threshold) { data = InterpolateEdges(data, ref width, ref height, edgeColor); Edges edges = new Edges(width, height); int maxSide = Math.Max(width, height) - 1; for (int i = 1; i < maxSide; i++) { int edgeColorsHorz = 0, edgeColorsVert = 0; for (int j = 1; j < maxSide; j++) { DetectEdge(data, i, j, width, height, edgeColor, ref edgeColorsHorz); DetectEdge(data, j, i, height, width, edgeColor, ref edgeColorsVert); } StoreEdge(edgeColorsHorz, i, width, threshold, edges.Horz); StoreEdge(edgeColorsVert, i, height, threshold, edges.Vert); } edges.CompleteBorderEdges(); return(edges); }
private Edges DetectEdges(byte* data, int width, int height, byte edgeColor, float threshold) { data = InterpolateEdges(data, ref width, ref height, edgeColor); Edges edges = new Edges(width, height); int maxSide = Math.Max(width, height) - 1; for (int i = 1; i < maxSide; i++) { int edgeColorsHorz = 0, edgeColorsVert = 0; for (int j = 1; j < maxSide; j++) { DetectEdge(data, i, j, width, height, edgeColor, ref edgeColorsHorz); DetectEdge(data, j, i, height, width, edgeColor, ref edgeColorsVert); } StoreEdge(edgeColorsHorz, i, width, threshold, edges.Horz); StoreEdge(edgeColorsVert, i, height, threshold, edges.Vert); } edges.CompleteBorderEdges(); return edges; }