//the big boy, iterates through the pixels and drives algorithms public void run(ProgressBar progressBar1) { if (pixels == null) { MessageBox.Show("No Pixels Loaded", "no pixels", 0); return; } selection s = new selection(pixels, imageWidth, totalPixels); for (int i = 0; i < totalPixels; i++) { progressBar1.Value = i; if (s.get(i)) { buffer = s.Buffer; perimeter = s.Perimeter; objectData dat = new objectData(getAverageValue(), buffer.Count, buffer.Count / s.getedges()); conf c = confidence.getconfidence(dat); dat.objconf = c; objdat.Add(dat); if (!c.isStructure) { colorbuffer(constants.COLOR_CLEAR); } } s.clearbuffer(); buffer.Clear(); } }
public static conf getconfidence(objectData d) { //avg, size, edge conf c = new conf(); value(c, d.avgval); size(c, d.size); edges(c, d.edgeratio); c.dust = c.d_edge + c.d_size + c.d_val; c.structure = c.s_edge + c.s_size + c.s_val; if (c.dust > c.structure) { c.isStructure = false; } else { c.isStructure = true; } return(c); }