} // end analyze private void separateEdges() { int color = -1; Color temp = Color.Blue; edgeDataHolder = edgeData; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { if (edgeData[x, y]) { color++; if (color == groupColors.Length) { color = 0; } temp = groupColors[color]; //make a new edge group, and add all edges to the group as they are found EdgeGroup group = new EdgeGroup(new Edge(x, y)); edgeGroups.Add(group); //cycle clockwise from (x-1, y-1) ArrayList edgeGroup = new ArrayList(); ArrayList toScan = new ArrayList(); //contains all pixels that need scanning toScan.Add(new Edge(x, y)); ArrayList tempE = new ArrayList(); //contains all pixels to be added to toScan at the end of cycle Edge[] holder; //holds edges from scan int[] next = new int[2] { x, y }; edgeData[x, y] = false; img.SetPixel(x, y, temp); while (toScan.Count > 0) //one run of the inside of this loop is a cycle { for (int i = 0; i < toScan.Count; i++) { int xT = ((Edge)toScan[i]).getX(); int yT = ((Edge)toScan[i]).getY(); try { img.SetPixel(xT, yT, temp); } catch { } holder = scan(new int[] { xT, yT }, pixelThresh); for (int q = 0; q < holder.Length; q++) { tempE.Add(holder[q]); //Debug.WriteLine("edge [" + q + "]" + "x" + holder[q].getX() + " y " + holder[0].getY()); } } toScan = (ArrayList)tempE.Clone(); tempE = new ArrayList(); } } } } edgeData = edgeDataHolder; pictureBox1.Image = img; } //end separate