private void AddObject(ref string s, long cnt, CiObject Obj) { s = s + "Object #" + cnt.ToString(); s = s + " Pixels:" + Obj.Pixels.ToString() + " Intervals:" + Obj.Intervals.ToString(); s = s + " Rect:" + Obj.Rect.left.ToString() + ":" + Obj.Rect.top.ToString() + "-" + Obj.Rect.right.ToString() + ":" + Obj.Rect.bottom.ToString(); s = s + Environment.NewLine; }
internal string toolsPage(string fileName, int page) { CiTools tools = null; try { CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer(); tools = ci.CreateTools(); string s = ""; int cnt = 0; tools.Image.Open(fileName, page); double dSkew = tools.MeasureSkew(); s = s + string.Format("Skew {0:0.##} deg", dSkew) + Environment.NewLine; if (tools.Image.BitsPerPixel == 1) { CiObject obj = tools.FirstObject(); while (obj != null) { cnt++; if (cnt < 10 && obj.Pixels > 1) { AddObject(ref s, cnt, obj); } obj = tools.NextObject(); } s = s + string.Format("Object Count: {0}", cnt) + Environment.NewLine; } return(s); } catch (Exception ex) { return(ex.Message); } finally { if (tools != null) { tools.Image.Close(); // ClearImage V9 and later. Immediately free memory } } }