跳轉到主要內容
此介面已在 Linux 和 Windows 版 FRE 中實作。
這是用於自訂影像來源的介面。此介面及其所有方法皆在用戶端實作。Batch Processor (BatchProcessor 物件) 會使用此介面。 此介面可讓您以自訂方式實作影像處理佇列。Batch Processor 會使用 GetNextImageFile 或 GetNextImageDocument 方法,從此佇列取得下一個影像。
佇列中的所有 ImageDocument 物件,在處理完成前都必須保持有效。為確保正確運作,ImageDocument 物件應透過 Engine 物件建立。若透過 FRDocument 物件建立,則可能會發生錯誤,因為在呼叫 GetNextImageDocument 方法期間,FRDocument 物件可能會被銷毀。

方法

名稱說明
GetNextImageDocument回傳來源的影像處理佇列中的下一個影像文件。
GetNextImageFile回傳來源的影像處理佇列中的下一個影像檔案。
IsEmpty檢查來源的影像處理佇列中是否有任何影像檔案。

輸入參數

BatchProcessor 物件的 Start 方法會將此介面的指標作為輸入參數傳入。

範例

// 自訂影像來源的範例實作,會維護影像檔案佇列
public class ImageSourceCallback : FREngine.IImageSource
{
   public ImageSourceCallback( string imageFilesDirectory )
   {
       imageFiles = ImageSourceHelper.LoadFilesNames( imageFilesDirectory );
       nextFileIndex = 0;
   }
   public bool IsEmpty()
   {
       return nextFileIndex >= imageFiles.Length;
   }
   public FREngine.IFileAdapter GetNextImageFile()
   {
       if( !IsEmpty() ) {
           return new FileAdapterCallback( imageFiles[nextFileIndex++] );
       }
       return null;
   }
   public FREngine.IImageDocument GetNextImageDocument()
   {
       ...
   }
   private string[] imageFiles;
   private int nextFileIndex;
}
public class FileAdapterCallback : FREngine.IFileAdapter
{
    ...
}
public class ImageSourceHelper
{
    ...
}
此介面用於下列程式碼範例:BatchProcessing;以及 Windows Demo Tools 中的 BatchProcessingRecognition

另請參閱

BatchProcessor