public override void FindBestCuts() { unchecked { for (int i = 0; i < cutcosts.Length(); i++) { NarrayUtil.ExtPut(dimage, i, (int)(cutcosts[i] + 10), 0xff0000); } for (int i = 0; i < cutcosts.Length(); i++) { NarrayUtil.ExtPut(dimage, i, (int)(min_thresh + 10), 0x800000); } } Floatarray temp = new Floatarray(); Gauss.Gauss1d(temp, cutcosts, 3.0f); cutcosts.Move(temp); SegmRoutine.local_minima(ref bestcuts, cutcosts, min_range, min_thresh); for (int i = 0; i < bestcuts.Length(); i++) { Narray <Point> cut = cuts[bestcuts[i]]; for (int j = 0; j < cut.Length(); j++) { Point p = cut[j]; NarrayUtil.ExtPut(dimage, p.X, p.Y, 0x00ff00); } } ///-if(debug.Length > 0) write_image_packed(debug, dimage); // dshow1d(cutcosts,"Y"); //dshow(dimage,"Y"); }
public void FindBestCuts() { /*Intarray segm = new Intarray(); * segm.Copy(dimage); * ImgLabels.simple_recolor(segm); * ImgIo.write_image_packed("debug1.png", segm);*/ unchecked { for (int i = 0; i < cutcosts.Length(); i++) { NarrayUtil.ExtPut(dimage, i, (int)(cutcosts[i] + 10), 0xff0000); } for (int i = 0; i < cutcosts.Length(); i++) { NarrayUtil.ExtPut(dimage, i, (int)(min_thresh + 10), 0x800000); } } Floatarray temp = new Floatarray(); Gauss.Gauss1d(temp, cutcosts, cost_smooth); cutcosts.Move(temp); SegmRoutine.local_minima(ref bestcuts, cutcosts, min_range, min_thresh); for (int i = 0; i < bestcuts.Length(); i++) { Narray <Point> cut = cuts[bestcuts[i]]; for (int j = 0; j < cut.Length(); j++) { Point p = cut[j]; NarrayUtil.ExtPut(dimage, p.X, p.Y, 0x00ff00); } } /*segm.Copy(dimage); * ImgLabels.simple_recolor(segm); * ImgIo.write_image_packed("debug2.png", segm);*/ }