public void InstantiatePreviewTileAtPosition(GridTile tilePrefab, Vector2Int position, Vector3 offsetPosition, Quaternion rotation)
    {
        // Parameters
        var      gridCellCenter   = GridManager.Instance.m_Grid.GetCellCenterWorld(position.ToVector3IntXY0());
        var      worldPosition    = gridCellCenter + offsetPosition;
        GridTile instantiatedTile = null;

        if (PrefabUtility.IsPartOfPrefabAsset(tilePrefab.gameObject))
        {
            instantiatedTile = (GridTile)PrefabUtility.InstantiatePrefab(tilePrefab);
        }
        else
        {
            instantiatedTile = (GridTile)Instantiate(tilePrefab, worldPosition, rotation, m_PreviewObjectsHolder) as GridTile;
        }
        instantiatedTile.transform.parent   = m_PreviewObjectsHolder;
        instantiatedTile.transform.position = worldPosition;
        instantiatedTile.transform.rotation = rotation;
        // Preview tile
        var previewTile = new PreviewObject(instantiatedTile.gameObject, position);

        m_PreviewObjects.Add(previewTile);
        // Make the renderers attached to it transparent
        MakeVisualizerTransparent(instantiatedTile.transform);
        // Destroy the grid component
        //DestroyImmediate(instantiatedTile);
        var components = instantiatedTile.GetComponents <MonoBehaviour>();

        foreach (MonoBehaviour comp in components)
        {
            comp.enabled = false;
        }
    }
Exemple #2
0
        public PreviewObject ProcessImage(Mat image, IProgress <int> progress)
        {
            PreviewObject p   = new PreviewObject();
            Image         img = null;

            try
            {
                try
                {
                    img = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(image);
                }
                catch (NullReferenceException e)
                {
                    throw new NullReferenceException(e.Message, e.InnerException);
                }


                var conf = RunTesseract(image);

                confidence = ((Double)(conf) / 100).ToString("P2");


                p.Confidence = confidence;
                p.Img        = img;
                p.Lines      = _textLines;
                p.Lang       = _lang;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e.InnerException);
            }
            progress.Report(40);

            return(p);
        }
 public Form1(PreviewObject file)
 {
     InitializeComponent();
     _myPenword = new Pen(Color.Blue, 2f);
     if (file != null)
     {
         btnRemove.Enabled = false;
         _def = file;
         pictureBox1.Image = (Bitmap)file.Img;
         _newImage         = file.Img;
         _p = file;
         txtPathPattern.Visible  = false;
         btnNewFile.Visible      = false;
         propGrid.SelectedObject = file;
         ClientCollectionEditor.CollectionChanged += new EventHandler(OnMeasuredParamsChanged);
         this.Text = "Image preview";
         FillListView(file);
         FillCombo();
     }
     else
     {
         this.Text = "Pattern creation";
         //idem vytvarat novy pattern
         lblPatConfidence.Visible  = false;
         txtPartConfidence.Visible = false;
     }
 }
 private void ProcessLines(PreviewObject p, IProgress <int> progress)
 {
     using (DictionaryService dict = new DictionaryService())
     {
         dict.MakeObjectsFromLines(p, progress);
     }
 }
 void Awake()
 {
     Preview                  = this;
     m_spriteRend             = GetComponent <SpriteRenderer>();
     m_lineRend               = GetComponent <LineRenderer>();
     m_lineRend.positionCount = m_circleSegCount;
 }
        private void button2_Click(object sender, System.EventArgs e)
        {
            using (var fbd = new OpenFileDialog())
            {
                DialogResult result = fbd.ShowDialog();

                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.FileName))
                {
                    txtPathPattern.Text = fbd.FileName;
                }
            }
            _files = FileService.FindFiles(txtPathPattern.Text, CONSTANTS.filter);
            if (_files == null)
            {
                MessageBox.Show("Unsupported file format OR you don't have rights to that file!!!", "Invalid format", MessageBoxButtons.OK);
                return;
            }

            ClientCollectionEditor.CollectionChanged += new EventHandler(OnMeasuredParamsChanged);


            pictureBox1.Image = new Bitmap(_files[0]);
            _newImage         = (Image)pictureBox1.Image.Clone();
            _p      = new PreviewObject();
            _p.Path = txtPathPattern.Text;

            propGrid.SelectedObject = _p;
            FillCombo();
        }
    private void ResizingColliders()
    {
        Vector2 colliderSize = (MarkTileMap.MapSize * MarkTileMap.TileSize) + colliderOffset;

        colliderSize /= transform.lossyScale;

        var draggableCollider = PreviewObject.GetComponent <BoxCollider2D>();

        draggableCollider.size = colliderSize;
        touchCollider.size     = colliderSize;

        switch (Furniture.CurrentDirection)
        {
        case Direction.Up:
            touchCollider.offset = new Vector2(0f, -colliderDirectionExtend);
            break;

        case Direction.Right:
            touchCollider.offset = new Vector2(-colliderDirectionExtend, 0f);
            break;

        case Direction.Down:
            touchCollider.offset = new Vector2(0f, colliderDirectionExtend);
            break;

        case Direction.Left:
            touchCollider.offset = new Vector2(colliderDirectionExtend, 0f);
            break;
        }

        touchCollider.size += new Vector2(Mathf.Abs(touchCollider.offset.x), Mathf.Abs(touchCollider.offset.y));
    }
Exemple #8
0
    public void Build()
    {
        PreviewObject po = preview.GetComponent <PreviewObject> ();

        if (po.isBuildable)
        {
            Instantiate(currObject.prefab, currPosition, Quaternion.Euler(currRotation));
        }
    }
    public void Build()
    {
        PreviewObject PO = currentPreview.GetComponent <PreviewObject>();

        if (PO.IsBuildable)
        {
            Instantiate(currentObject.prefab, currentPos, Quaternion.Euler(currentRotation));
        }
    }
 public override void Awake()
 {
     base.Awake();
     preview = Instantiate(previewPrefab, new Vector3(), Quaternion.AngleAxis(90, Vector3.right));
     anim    = preview.GetComponent <Animator>();
     Debug.Log("Preview " + preview + ", Animator " + anim);
     Debug.Log("clip " + anim.GetNextAnimatorClipInfo(0));
     previousPlayerLength = 0;
     preview.SetElement(PreviewObject.Element.MIRROR);
 }
//Spawns in the object
    public void Build()
    {
        PreviewObject PO = curPrev.GetComponent <PreviewObject>();

        print(curObj.cost);
        print(CS.Currency);
        if (PO.isBuildable && curObj.cost <= CS.Currency)
        {
            Instantiate(curObj.prefab, curPos, Quaternion.Euler(curRot));
        }
    }
Exemple #12
0
        private void btnRemove_Click(object sender, System.EventArgs e)
        {
            var w = GetSelectedWords();

            if (w != null)
            {
                _p.ListOfKeyPossitions.Remove(w);
                _def = _p;
                FillListView(_p);
            }
        }
    public void Build()
    {
        PreviewObject PO = currentPreview.GetComponent <PreviewObject>();

        if (PO.IsBuildable)
        {
            Instantiate(currentObject.prefab, currentPos, Quaternion.Euler(currentRot));
            IsBuilding = false;
            Destroy(currentPreview.gameObject);
        }
    }
Exemple #14
0
        private void FillListView(PreviewObject prew)
        {
            BindingList <PossitionOfWord> bindingList = new BindingList <PossitionOfWord>(prew.ListOfKeyPossitions);

            foreach (var col in prew.ListOfKeyColumn)
            {
                var rec = new Rectangle(col.Left, col.Top, col.Right - col.Left, col.Bottom - col.Top);
                bindingList.Add(new PossitionOfWord(col.Text, rec, string.Empty, rec));
            }
            dataGridValues.AutoGenerateColumns = false;
            dataGridValues.DataSource          = bindingList;
        }
    public void Rotate()
    {
        Furniture.Rotate();

        var draggableTileMap = PreviewObject.GetComponent <TileMap2D>();

        draggableTileMap.Reverse();
        MarkTileMap.Reverse();

        ResizingColliders();

        PreviewObject.GetComponent <SpriteRenderer>().sprite = Furniture.GetComponent <SpriteRenderer>().sprite;
    }
    private void PreviewObjectSetup()
    {
        var previewRenderer = PreviewObject.GetComponent <SpriteRenderer>();

        previewRenderer.sprite = GetComponent <SpriteRenderer>().sprite;

        var draggableObject = PreviewObject.GetComponent <DraggableObject>();

        draggableObject.onDragStarted.AddListener(OnDragStarted);
        draggableObject.onDragEnded.AddListener(OnDragEnded);

        var draggableTileMap = PreviewObject.GetComponent <TileMap2D>();

        draggableTileMap.MapSize = MarkTileMap.MapSize;
    }
    public void Set(NPVoxMeshOutput _meshOutput, NPVoxNormalProcessor _processor)
    {
        MeshOutput      = _meshOutput;
        ViewedProcessor = _processor;
        PreviewObject   = MeshOutput.Instatiate();

        VoxToUnity = new NPVoxToUnity(MeshOutput.GetVoxModel(), MeshOutput.VoxelSize);

        MeshFilter mf = PreviewObject.GetComponent <MeshFilter>();

        PreviewMesh   = Mesh.Instantiate <Mesh>(mf.sharedMesh);
        mf.sharedMesh = PreviewMesh;

        PreviewObject.hideFlags = HideFlags.HideAndDontSave;
        PreviewObject.SetActive(false);
        IsValid = true;
    }
        public static bool GenerateTxtFile(PreviewObject item)
        {
            Client dod = new Client();
            Client odb = new Client();
            Client pos = new Client();
            Client kon = new Client();

            GetClients(item, ref dod, ref odb, ref pos, ref kon);

            string date = item?.Evidence?.DateOfCreate == "" ? item?.Evidence?.DocumentCreateDate : item?.Evidence?.DateOfCreate;

            string textToFileR00 = $@"R00{tab}T01{tab}{dod?.Name}{tab}{dod?.ICO}{tab}{dod?.Street}{tab}{dod?.PSC}{tab}{dod?.City}{newLine}";

            textToFileR00 += GenerateTxtFile(item, dod, odb, pos, kon);
            CreateFile($@".\..\..\..\Export\invoice{DateTime.Now.ToLongDateString()}.txt", textToFileR00);

            return(true);
        }
        private static void GetClients(PreviewObject item, ref Client dod, ref Client odb, ref Client pos, ref Client kon)
        {
            foreach (Client c in item.Clients)
            {
                if (Common.RemoveDiacritism(c.ClientID).Equals("Dodavatel"))
                {
                    dod = c;
                    continue;
                }
                else if (Common.RemoveDiacritism(c.ClientID).Equals("Odberatel"))
                {
                    odb = c;
                    continue;
                }
                else if (Common.RemoveDiacritism(c.ClientID).Equals("Postova adresa") || Common.RemoveDiacritism(c.ClientID).Equals("Adresa") || Common.RemoveDiacritism(c.ClientID).Equals("Korespondencna adresa"))
                {
                    pos = c;
                    continue;
                }
                else if (Common.RemoveDiacritism(c.ClientID).Equals("Konecny prijemca"))
                {
                    kon = c;
                    continue;
                }
            }

            if (dod == null)
            {
                dod = new Client();
            }
            if (odb == null)
            {
                odb = new Client();
            }
            if (pos == null)
            {
                pos = new Client();
            }
            if (kon == null)
            {
                kon = new Client();
            }
        }
        public static string GenerateTxtFile(PreviewObject item, Client dod, Client odb, Client pos, Client kon)
        {
            string date = item?.Evidence?.DateOfCreate == "" ? item?.Evidence?.DocumentCreateDate : item?.Evidence?.DateOfCreate;

            string textToFileR00 = $"R01{tab}{item?.Evidence?.OrderNumber}{tab}{odb?.Name}{tab}{odb?.ICO}{tab}{date}{tab}{item?.Evidence?.DateOfPayment}{tab}{item?.Evidence?.DateOfTax}{tab}";

            textToFileR00 += $"{item?.Evidence?.BaseLower}{tab}{item?.Evidence?.BaseHigher}{tab}{item?.Evidence?.BaseZero}{tab}{item?.Evidence?.BaseNotContain}{tab}{item?.Evidence?.RateLower}{tab}{item?.Evidence?.RateHigher}{tab}{item?.Evidence?.AmountLower}{tab}{item?.Evidence?.AmountHigher}{tab}{tab}{item?.Evidence?.Amount}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}";
            textToFileR00 += $"{odb?.Street}{tab}{odb?.PSC}{tab}{odb?.City}{tab}{odb?.DIC}{tab}{tab}{tab}{tab}{tab}{tab}{item?.Evidence?.EvidenceNumber}{tab}";
            textToFileR00 += $"{item?.Evidence?.CreatorName}{tab}{item?.Evidence?.KonstSymbol}{tab}{item?.Evidence?.VariabilSymbol}{tab}{item?.Evidence?.SpecSymbol}{tab}";
            textToFileR00 += $"{item?.Evidence?.RefundMethode}{tab}{item?.Evidence?.Transport}{tab}EUR{tab}1{tab}1{tab}{item?.Evidence?.Amount}{tab}{odb?.State}{tab}{odb?.ICDPHStateCode}{tab}{odb?.ICDPH}{tab}";
            textToFileR00 += $"{dod?.AccountNumber}{tab}{dod?.Bank}{tab}{odb?.State}{tab}{tab}{tab}{dod?.SWIFT}{tab}{dod?.IBAN}{tab}{dod?.ICDPHStateCode}{tab}{dod?.ICDPH}{tab}{dod?.State}{tab}";
            textToFileR00 += $"{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{item?.Evidence?.DateOfCreate}{tab}{tab}{item?.Evidence?.VariabilSymbol}{tab}";
            textToFileR00 += $"{tab}{pos?.Name}{tab}{tab}{tab}{pos?.Street}{tab}{pos?.PSC}{tab}{pos?.City}{tab}{tab}{tab}{tab}{item?.Evidence?.CreatorName}{tab}{dod?.Phone}{tab}";
            textToFileR00 += $@"{tab}{tab}{odb?.IBAN}{tab}{odb?.AccountNumber}{newLine}";



            return(textToFileR00);
        }
    public void InstantiatePreviewGridObjectAtPosition(GridObject objectPrefab, Vector2Int position, Vector3 offsetPosition, Orientations orientation)
    {
        // Check if there is a tile there
        var tileAtPosition = GridManager.Instance.GetGridTileAtPosition(position);

        if (!tileAtPosition)
        {
            return;
        }


        // Parameters
        var        gridCellCenter     = GridManager.Instance.m_Grid.GetCellCenterWorld(position.ToVector3IntXY0());
        var        worldPosition      = gridCellCenter + offsetPosition;
        GridObject instantiatedObject = null;

        if (PrefabUtility.IsPartOfPrefabAsset(objectPrefab.gameObject))
        {
            instantiatedObject = (GridObject)PrefabUtility.InstantiatePrefab(objectPrefab);
        }
        else
        {
            instantiatedObject = (GridObject)Instantiate(objectPrefab, worldPosition, Quaternion.identity, m_PreviewObjectsHolder) as GridObject;
        }
        var cellPosition = tileAtPosition.m_GridObjectsPivotPosition;

        instantiatedObject.transform.parent   = m_PreviewObjectsHolder;
        instantiatedObject.transform.position = cellPosition;
        instantiatedObject.transform.rotation = GridManager.Instance.OrientationToRotation(position, orientation);
        // Preview tile
        var previewObject = new PreviewObject(instantiatedObject.gameObject, position);

        m_PreviewObjects.Add(previewObject);
        // Make the renderers attached to it transparent
        MakeVisualizerTransparent(instantiatedObject.transform);

        var components = instantiatedObject.GetComponents <MonoBehaviour>();

        foreach (MonoBehaviour comp in components)
        {
            comp.enabled = false;
        }
    }
        /// <summary>
        /// Iterate trought lines
        /// Try to find relevant data and store them
        /// </summary>
        /// <param name="lines">List of lines</param>
        /// <param name="width">Width of document</param>
        /// <returns></returns>
        public void MakeObjectsFromLines(PreviewObject p, IProgress <int> progress)
        {
            _p                     = p;
            _dic                   = (Dictionary)Dictionary.GetInstance().Clone();
            _eud                   = new Evidence();
            _listOfColumns         = new List <Column>();
            _TempListOfColumn      = new List <Column>();
            _listOfClients         = new List <Client>();
            _keysToDelete          = new List <string>();
            _p.ListOfKeyPossitions = new List <PossitionOfWord>();
            foreach (TextLine line in p.Lines)
            {
                line.Text  = line.Text.Trim(CONSTANTS.charsToTrimLine);
                _keysInRow = 0;
                _listOfColumns.AddRange(_TempListOfColumn);
                _TempListOfColumn.Clear();
                foreach (var item in _dic.header.Where(c => _keysToDelete.Contains(c.Value)).ToList())
                {
                    _dic.header.Remove(item.Key);
                }
                _keysToDelete.Clear();

                if (GoLikeColumn())
                {
                    FillColumns(line);
                    continue;
                }
                string t = line.Text;
                GetDataFromLine(line, ref t, _dic.header, _eud);



                progress.Report(1);
            }

            _p.ListOfKeyColumn = new List <Column>(_listOfColumns);
            _p.Evidence        = _eud;
            _p.Clients         = new ClientCollection(_listOfClients)
            {
                Capacity = 5
            };
        }
Exemple #23
0
        private void SaveDataToPreviewObject(string key, PossitionOfWord w, PreviewObject prew)
        {
            if (prew.Clients.Count > 0)
            {
                foreach (Client c in prew.Clients)
                {
                    if (key.Contains(Common.RemoveDiacritism(c.ClientID)))
                    {
                        Type         type = c.GetType();
                        PropertyInfo prop = type.GetProperty(w.DictionaryKey);
                        prop.SetValue(c, w.Value, null);
                        return;
                    }
                }
            }

            foreach (KeyValuePair <string, string> pair in Dictionary.GetInstance().columns)
            {
                var txt = Common.RemoveDiacritism(pair.Key);
                if (key.Contains(txt))
                {
                    var c = new Client();
                    c.ClientID = txt;
                    Type         type = c.GetType();
                    PropertyInfo prop = type.GetProperty(w.DictionaryKey);
                    prop.SetValue(c, w.Value, null);
                    prew.Clients.Add(c);
                    return;
                }
            }

            // it's an Evidence value

            Type         typeE = prew.Evidence.GetType();
            PropertyInfo propE = typeE.GetProperty(w.DictionaryKey);

            propE.SetValue(prew.Evidence, w.Value, null);
        }
        public async Task StartService()
        {
            foreach (FileToProcess s in _filesToProcess)
            {
                var progress = new Progress <int>(percent =>
                {
                    if ((s.ProgressBar.Value + percent) > 100)
                    {
                        s.ProgressBar.Value = 100;
                    }
                    else
                    {
                        s.ProgressBar.Value = s.ProgressBar.Value + percent;
                    }
                });
                await Task.Run(async() =>
                {
                    var _cvService = OpenCVImageService.GetInstance();

                    if (SETTINGS.UseGoogleVision)
                    {
                        Annotate anotate = new Annotate();
                        _cvService.PrepareImageForGoogle(s.Path, progress, SETTINGS.TesseractLang);

                        await anotate.GetText(_cvService.Rotated, SETTINGS.GoogleLang, "TEXT_DETECTION");
                        var response    = anotate.Response;
                        PreviewObject p = new PreviewObject();
                        p.Path          = s.Path;
                        p.Lang          = SETTINGS.TesseractLang;
                        p.Img           = _cvService.bmp;
                        p.Lines         = MakeLinesFromWord(response);
                        ProcessLines(p, progress);
                        _previewObjects.Add(p);
                    }
                    else
                    {
                        TesseractService tess = new TesseractService(SETTINGS.TesseractLang);
                        _cvService.PrepareImage(s.Path, progress, SETTINGS.TesseractLang);
                        Mat image     = _cvService.Rotated;
                        double ratioX = 1;
                        double ratioY = 1;
                        var id        = CheckForPattern(tess, image, ref ratioX, ref ratioY);
                        if (id == -1)
                        {
                            PreviewObject p = tess.ProcessImage(image, progress);
                            p.Path          = s.Path;
                            ProcessLines(p, progress);
                            _previewObjects.Add(p);
                        }
                        else
                        {
                            PreviewObject prew;
                            // pattern found => use it
                            tess.CheckImageForPatternAndGetDataFromIt(image, GetKeysPossitions(id), progress, out prew, ratioX, ratioY);
                            prew.Path = s.Path;
                            _previewObjects.Add(prew);
                        }
                    }
                });

                s.ProgressBar.Value = 100;
                s.Button.Enabled    = true;
            }
        }
Exemple #25
0
    static void Init()
    {
        PreviewObject previewObject = (PreviewObject)EditorWindow.GetWindow(typeof(PreviewObject));

        previewObject.Show();
    }
 public CreateNewObjectCommand(List <SceneObjectDataContainer> container, PreviewObject newObject, Point pos)
 {
     _newObject = newObject;
     _position  = pos;
     _container = container;
 }
Exemple #27
0
        public bool CheckImageForPatternAndGetDataFromIt(Mat image, List <PossitionOfWord> pos, IProgress <int> progress, out PreviewObject prew, double ratioX, double ratioY,
                                                         bool checkPattern = false)
        {
            PreviewObject p = new PreviewObject();

            if (pos.Count > 0)
            {
                int  step      = 1;
                bool isPattern = true;
                p.ListOfKeyColumn = new List <Column>();
                try
                {
                    int conf = 0;

                    p.ListOfKeyPossitions = new List <PossitionOfWord>();
                    p.Lines = new List <TextLine>();

                    if (!checkPattern)
                    {
                        conf = RunTesseract(image);

                        progress.Report(20);

                        foreach (PossitionOfWord w in pos)
                        {
                            if (w.KeyBounds.Equals(w.ValueBounds))
                            {
                                p.ListOfKeyColumn.Add(new Column(w.Value, w.ValueBounds.Left, w.ValueBounds.Right, w.ValueBounds.Bottom, w.ValueBounds.Top));
                            }


                            var    line = GetLineForValueBounds(w);
                            string text = Common.GetWordsForColumn(new Column("", w.ValueBounds.Left, w.ValueBounds.Right, 0, 0), line);
                            w.Value = text.Trim(CONSTANTS.charsToTrimLineForpossition);

                            var key = Common.RemoveDiacritism(w.Key);
                            SaveDataToPreviewObject(key, w, p);



                            progress.Report(step);
                            p.ListOfKeyPossitions.Add(w);
                        }
                        p.Lines.AddRange(_textLines);
                    }
                    else
                    {
                        foreach (PossitionOfWord w in pos)
                        {
                            OpenCvSharp.Rect rec;
                            // if checking pattern, check only the keys
                            rec = new Rect(w.KeyBounds.X, w.KeyBounds.Y, w.KeyBounds.Width, w.KeyBounds.Height);


                            rec.X      -= CONSTANTS.PATTERN_CHECK_XY_PROXIMITY;
                            rec.Y      -= CONSTANTS.PATTERN_CHECK_XY_PROXIMITY;
                            rec.Width  += CONSTANTS.PATTERN_CHECK_WIDTHHEIGHT_PROXIMITY; //if checking for patterns, boundung box should be as small as it's possible
                            rec.Height += CONSTANTS.PATTERN_CHECK_WIDTHHEIGHT_PROXIMITY;

                            // set positions according to document size, bacuase i can get same document but with different size
                            if (ratioX != 0 && ratioY != 0)
                            {
                                rec.X      = (int)(rec.X * ratioX);
                                rec.Y      = (int)(rec.Y * ratioY);
                                rec.Width  = (int)(rec.Width * ratioX);
                                rec.Height = (int)(rec.Height * ratioY);
                            }

                            // hceck max/min positions
                            if (image.Cols < rec.X + rec.Width)
                            {
                                rec.Width -= (rec.X + rec.Width) - image.Cols;
                            }
                            if (image.Rows < rec.Y + rec.Height)
                            {
                                rec.Height = image.Rows;
                            }
                            Mat im = new Mat(image, rec);

                            conf = RunTesseract(im);

                            bool pat = false;
                            foreach (TextLine line in _textLines)
                            {
                                var s = Common.RemoveDiacritism(line.Text.Trim(CONSTANTS.charsToTrimLineForpossition));
                                var k = Common.RemoveDiacritism(w.Key);
                                if (SimilarityService.GetSimilarity(s, k) > 90 || s.Contains(k) || k.Contains(s))
                                {
                                    pat = true;
                                }
                            }

                            if (!pat)
                            {
                                isPattern = false;
                                break;
                            }

                            w.Confidence = GetConfForLine(_textLines[0]);
                            p.ListOfKeyPossitions.Add(w);
                            p.Lines.AddRange(_textLines);
                            _textLines.Clear();
                        }
                    }

                    p.Confidence = string.Format("{0:N2}%", (conf) / 100);
                    p.Img        = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(image);
                    p.Lang       = _lang;
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message, e.InnerException);
                }
                prew = p;
                return(isPattern);
            }
            prew = p;
            return(false);
        }