跳轉到主要內容
這個方法會偵測影像上指定Rectangle區域內的文字與背景顏色。此Rectangle應使用以 ImageDocument 的已校正傾斜黑白頁面為基準的座標來指定。

語法

C++

HRESULT GetTextBackgroundColor(
  int  Left,
  int  Top,
  int  Right,
  int  Bottom,
  int  Flags,
  int* TextColor,
  int* BackgroundColor
);

C#

void GetTextBackgroundColor(
  int     Left,
  int     Top,
  int     Right,
  int     Bottom,
  int     Flags,
  out int TextColor,
  out int BackgroundColor
);

Visual Basic .NET

Sub GetTextBackgroundColor( _
  Left As Integer, _
  Top As Integer, _
  Right As Integer, _
  Bottom As Integer, _
  Flags As Integer, _
  ByRef TextColor As Integer, _
  ByRef BackgroundColor As Integer _
)

參數

Left [in] 此參數包含Rectangle左邊界的座標。 Top [in] 此參數包含Rectangle上邊界的座標。 Right [in] 此參數包含Rectangle右邊界的座標。 Bottom [in] 此參數包含Rectangle下邊界的座標。 Flags [in] 此參數可為 0,或 DetectColorRegionFlags 模組中的 DCR_Invert 常數。如果傳入 DCR_Invert,則該Rectangle會被視為反相 (黑色背景上的白色文字) 。 TextColor [out] 此參數會接收Rectangle中文字顏色的值。 BackgroundColor [out] 此參數會接收Rectangle中背景顏色的值。

傳回值

此方法沒有特定的傳回值,而是會傳回 ABBYY FineReader Engine 函式的標準傳回值

備註

文字與背景色彩是根據 ImageDocument 中經過校正傾斜的黑白頁面資訊來偵測的。但傳回的色彩值會保留其在 ImageDocument 彩色頁面上的實際色彩。若經過校正傾斜的黑白影像平面中,位於指定Rectangle內的像素為黑色 (針對未反相的Rectangle) 或白色 (針對已反相的Rectangle) ,則該像素會被視為文字的一部分。如果此方法無法偵測文字和/或背景色彩,則會傳回未定義的色彩值 (0xFFFFFFFF) 。

另請參閱

ImageDocument