public void AddZone(RectangleF r) { int res; int BlkObj, w, h; NsOCR.Img_GetSize(ImgObj, out w, out h); res = NsOCR.Img_AddBlock(ImgObj, (int)r.Left, (int)r.Top, (int)r.Width, (int)r.Height, out BlkObj); //res = 0; if (res > TNSOCR.ERROR_FIRST) { ShowError("Img_AddBlock", res); return; } //detect text block inversion NsOCR.Blk_Inversion(BlkObj, TNSOCR.BLK_INVERSE_DETECT); //detect text block rotation NsOCR.Blk_Rotation(BlkObj, TNSOCR.BLK_ROTATE_DETECT); }
public void AddZone(RectangleF r, int id = 0, string name = "") { int res; int BlkObj, w, h; NsOCR.Img_GetSize(ImgObj, out w, out h); res = NsOCR.Img_AddBlock(ImgObj, (int)r.Left, (int)r.Top, (int)r.Width, (int)r.Height, out BlkObj); //res = 0; if (res > TNSOCR.ERROR_FIRST) { ShowError("Img_AddBlock", res); return; } this.IndexNewZone++; var newName = name; if (name == "") { newName = "Zone_" + this.IndexNewZone.ToString(); } this.ListZoneName.Add(new OrionRecognizeZoneDetail() { BlkObj = BlkObj, Name = newName, ID = id }); //detect text block inversion NsOCR.Blk_Inversion(BlkObj, TNSOCR.BLK_INVERSE_DETECT); //detect text block rotation NsOCR.Blk_Rotation(BlkObj, TNSOCR.BLK_ROTATE_DETECT); }