VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.VisualTools Namespace / FormFieldViewerTool Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс FormFieldViewerTool
    В этом разделе
    Визуальный инструмент, позволяющий отображать и взаимодействовать с распознанными полями формы на изображении.
    Объектная модель
    IObjectClipboard IInteractionController ImageViewer FormFieldViewerTool
    Синтаксис
    Пример

    Вот C#/VB.NET код, который демонстрирует, как распознавать форму и отображать результаты в просмотрщике изображений WinForms.

    
    ''' <summary>
    ''' Recognizes the current image of specified viewer
    ''' and shows recognition results in viewer.
    ''' </summary>
    ''' <param name="viewer">The viewer.</param>
    ''' <param name="formRecognitionManager">The form recognition manager.</param>
    Public Shared Function RecognizeAndShowInViewer(viewer As Vintasoft.Imaging.UI.ImageViewer, formRecognitionManager As Vintasoft.Imaging.FormsProcessing.FormRecognitionManager) As Boolean
        ' recognize the image
        Dim recognitionResult As Vintasoft.Imaging.FormsProcessing.FormRecognitionResult = formRecognitionManager.Recognize(viewer.Image)
    
        ' get the result of image comparison
        Dim imageCompareResult As Vintasoft.Imaging.FormsProcessing.TemplateMatching.ImageImprintCompareResult = recognitionResult.TemplateMatchingResult.ImageCompareResult
        ' if image is recognized
        If imageCompareResult.IsReliable Then
            ' create a visual tool
            Dim formFieldViewerTool As New Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.VisualTools.FormFieldViewerTool()
            ' create a view for the recognized page
            Dim pageView As Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.FormFieldView = Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.FormFieldViewFactory.CreateView(recognitionResult.RecognizedPage)
            ' add the view to the collection of the visual tool
            formFieldViewerTool.FieldViewCollection.Add(pageView)
            ' set the visual tool as current tool of the viewer
            viewer.VisualTool = formFieldViewerTool
            Return True
        Else
            Return False
        End If
    End Function
    
    
    
    /// <summary>
    /// Recognizes the current image of specified viewer
    /// and shows recognition results in viewer.
    /// </summary>
    /// <param name="viewer">The viewer.</param>
    /// <param name="formRecognitionManager">The form recognition manager.</param>
    public static bool RecognizeAndShowInViewer(
        Vintasoft.Imaging.UI.ImageViewer viewer,
        Vintasoft.Imaging.FormsProcessing.FormRecognitionManager formRecognitionManager)
    {
        // recognize the image
        Vintasoft.Imaging.FormsProcessing.FormRecognitionResult recognitionResult = 
            formRecognitionManager.Recognize(viewer.Image);
    
        // get the result of image comparison
        Vintasoft.Imaging.FormsProcessing.TemplateMatching.ImageImprintCompareResult imageCompareResult =
            recognitionResult.TemplateMatchingResult.ImageCompareResult;
        // if image is recognized
        if (imageCompareResult.IsReliable)
        {
            // create a visual tool
            Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.VisualTools.FormFieldViewerTool formFieldViewerTool = 
                new Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.VisualTools.FormFieldViewerTool();
            // create a view for the recognized page
            Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.FormFieldView pageView = 
                Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.FormFieldViewFactory.CreateView(recognitionResult.RecognizedPage);
            // add the view to the collection of the visual tool
            formFieldViewerTool.FieldViewCollection.Add(pageView);
            // set the visual tool as current tool of the viewer
            viewer.VisualTool = formFieldViewerTool;
            return true;
        }
        else
        {
            return false;
        }
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.Imaging.UI.VisualTools.VisualTool
          Vintasoft.Imaging.UI.VisualTools.UserInteraction.UserInteractionVisualTool
             Vintasoft.Imaging.FormsProcessing.FormRecognition.UI.VisualTools.FormFieldViewerTool

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также