public ChooseOCRAreaPage()
        {
            InitializeComponent();

            Common.ocr = OCRCommon.OCRAuto(Common.appSettings.OCRsource);

            //初始化钩子对象
            if (hook == null)
            {
                hook = new GlobalHook();
                hook.OnMouseActivity += new System.Windows.Forms.MouseEventHandler(Hook_OnMouseActivity);
            }
        }
        public OCRGeneralSettingsPage()
        {
            InitializeComponent();
            OCRSourceCombox.ItemsSource = OCRCommon.GetOCRList();

            OCRSourceCombox.SelectedValue = Common.appSettings.OCRsource;
            OCRHotKeyBox.Text             = Common.appSettings.GlobalOCRHotkey;

            Langlist = ImageProcFunc.lstOCRLang.Keys.ToList();
            OCRLangCombox.ItemsSource = Langlist;
            for (int i = 0; i < Langlist.Count; i++)
            {
                if (ImageProcFunc.lstOCRLang[Langlist[i]] == Common.appSettings.GlobalOCRLang)
                {
                    OCRLangCombox.SelectedIndex = i;
                }
            }
        }
예제 #3
0
        public ComicTransMainWindow()
        {
            InitializeComponent();

            TransResListView.ItemsSource = lstData;

            ComicImgList = new List <string>();
            CurrentPos   = 0;

            transRes1    = "";
            transRes2    = "";
            _translator1 = TranslateWindow.TranslatorAuto(Common.appSettings.FirstTranslator);
            _translator2 = TranslateWindow.TranslatorAuto(Common.appSettings.SecondTranslator);

            ocr = OCRCommon.OCRAuto(Common.appSettings.OCRsource);
            ocr.SetOCRSourceLang("jpn");
            if (Common.appSettings.OCRsource == "BaiduOCR")
            {
                if (ocr.OCR_Init(Common.appSettings.BDOCR_APIKEY, Common.appSettings.BDOCR_SecretKey) == false)
                {
                    HandyControl.Controls.Growl.ErrorGlobal($"百度OCR {Application.Current.Resources["APITest_Error_Hint"]}\n{ocr.GetLastError()}");
                }
            }
            else if (Common.appSettings.OCRsource == "Tesseract5_vert")
            {
                if (ocr.OCR_Init("", "") == false)
                {
                    HandyControl.Controls.Growl.ErrorGlobal($"Tesseract5_vert {Application.Current.Resources["APITest_Error_Hint"]}\n{ocr.GetLastError()}");
                }
            }
            else if (Common.appSettings.OCRsource == "TesseractOCR")
            {
                if (ocr.OCR_Init("", "") == false)
                {
                    HandyControl.Controls.Growl.ErrorGlobal($"TesseractOCR {Application.Current.Resources["APITest_Error_Hint"]}\n{ocr.GetLastError()}");
                }
            }


            scale = Common.GetScale();
            DrawingAttributes drawingAttributes = new DrawingAttributes
            {
                Color     = Colors.Red,
                Width     = 2,
                Height    = 2,
                StylusTip = StylusTip.Rectangle,
                //FitToCurve = true,
                IsHighlighter  = false,
                IgnorePressure = true,
            };

            inkCanvasMeasure.DefaultDrawingAttributes = drawingAttributes;

            viewModel = new ViewModel
            {
                MeaInfo    = "",
                InkStrokes = new StrokeCollection(),
            };

            DataContext = viewModel;
        }