예제 #1
0
        public string OCRProcessBitmap(Bitmap bim)
        {
            OCRTools.OCR ocr = new OCRTools.OCR();
            string ret = "";
            ListView lst = new ListView();

            ocr.ProductName = "StandardBar";
            ocr.CustomerName = "Version5";
            ocr.OrderID = "5142";
            ocr.RegistrationCodes = "7337-3411-0444-3204";
            ocr.ActivationKey = "1221-8631-8084-3595";

            ocr.OCRType = OCRTools.OCRType.Barcode;
            ocr.BitmapImage = bim;
            ocr.Process();

            //ocr.SetListViewBarcode(lst);
            //for (int i = 0; i < lst.Items.Count; i++)
            //{
            //    ret = lst.Items[i].SubItems[2].Text;
            //}
            //_err = ocr.TextResultsStatusMessage;
            ret = ocr.Text.Replace("*", "");
            return ret;
        }
예제 #2
0
        public string OCR([Bind(Include = "ContentId,Text,Note,Reference")] Content content, HttpPostedFileBase ePic = null)
        {
            OCR1 = new OCRTools.OCR();
            OCR1.DefaultFolder = Server.MapPath("/bin");

            OCR1.BitmapImage = (Bitmap)Image.FromStream(ePic.InputStream, true, true);

            //OCR1.BitmapImageFile = ePic.FileName;
            OCR1.Process();
            content.Note = OCR1.Text;

            return(content.Note);
        }
예제 #3
0
        public string OCRZoneProcess(string filename)
        {
            string ret = "";
            OCRTools.OCR ocr = new OCRTools.OCR();

            try
            {
                ocr.ProductName = "StandardBar";
                ocr.CustomerName = "Version5";
                ocr.OrderID = "5142";
                ocr.RegistrationCodes = "7337-3411-0444-3204";
                ocr.ActivationKey = "1221-8631-8084-3595";

                ocr.OCRType = OCRTools.OCRType.Barcode;
                ocr.BitmapImageFile = filename;

                int PointX = 728;
                int PointY = 1116;
                int bHeight = 250;
                int bWidth = 900;
                bool lResult = ocr.SetRegion(PointX, PointY, bWidth, bHeight);
                if (lResult == false)
                {
                    _err = "Error: Nothing selected. Enter Zone Coordinates, or lasso barcode with your mouse to assign coordinates";
                    return "";
                }

                ocr.Process();
                ret = ocr.Text.Replace("*", "");
            }
            catch (Exception e) {
                _err = ocr.TextResultsStatusMessage;
                ret = "";
            }

            return ret;
        }