跳转到主要内容
此方法用于检测图像中指定矩形区域内文本和背景的颜色。该矩形应使用相对于已纠偏黑白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] 此参数表示矩形左边界的坐标。 Top [in] 此参数表示矩形上边界的坐标。 Right [in] 此参数表示矩形右边界的坐标。 Bottom [in] 此参数表示矩形下边界的坐标。 Flags [in] 此参数的值可以是 0,也可以是 DetectColorRegionFlags 模块中的常量 DCR_Invert。如果传入 DCR_Invert,则该矩形将被视为反相矩形 (黑色背景上的白色文本) 。 TextColor [out] 此参数接收矩形内文本颜色的值。 BackgroundColor [out] 此参数接收矩形内背景颜色的值。

返回值

此方法没有特定的返回值。它会返回 ABBYY FineReader Engine 函数的标准返回值

备注

文本和背景颜色是根据 ImageDocument 纠偏后的黑白页面中的信息检测出来的。但返回的颜色与其在 ImageDocument 彩色页面上的颜色保持一致。如果纠偏后的黑白图像平面中,位于指定矩形内的某个像素为黑色 (对于未反相的矩形) 或白色 (对于已反相的矩形) ,则该像素会被视为文本的一部分。如果此方法无法检测文本和/或背景的颜色,则会返回未定义的颜色值 (0xFFFFFFFF) 。

另请参阅

ImageDocument