Interface ITextDetector<T>
- Namespace
- AiDotNet.Document.Interfaces
- Assembly
- AiDotNet.dll
Interface for text detection models that locate text regions in images.
public interface ITextDetector<T> : IDocumentModel<T>, IFullModel<T, Tensor<T>, Tensor<T>>, IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>, IModelSerializer, ICheckpointableModel, IParameterizable<T, Tensor<T>, Tensor<T>>, IFeatureAware, IFeatureImportance<T>, ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>, IGradientComputable<T, Tensor<T>, Tensor<T>>, IJitCompilable<T>
Type Parameters
TThe numeric type used for calculations.
- Inherited Members
- Extension Methods
Remarks
Text detection models find where text appears in an image without reading the text. They output bounding boxes (polygons or rectangles) around text regions.
For Beginners: Text detection is the first step in reading text from images. It's like highlighting all the places where text appears, but not actually reading it. After detection, a text recognizer reads the actual characters in each highlighted region.
Example usage:
var detector = new DBNet<float>(architecture);
var result = detector.DetectText(documentImage);
foreach (var region in result.TextRegions)
{
Console.WriteLine($"Found text at: {region.BoundingBox}");
}
Properties
MinTextHeight
Gets the minimum detectable text height in pixels.
int MinTextHeight { get; }
Property Value
SupportsPolygonOutput
Gets whether this detector outputs polygon bounding boxes (vs axis-aligned rectangles).
bool SupportsPolygonOutput { get; }
Property Value
SupportsRotatedText
Gets whether this detector supports rotated text detection.
bool SupportsRotatedText { get; }
Property Value
Methods
DetectText(Tensor<T>)
Detects text regions in an image.
TextDetectionResult<T> DetectText(Tensor<T> image)
Parameters
imageTensor<T>The input image tensor.
Returns
- TextDetectionResult<T>
Detection result with text region locations.
DetectText(Tensor<T>, double)
Detects text regions with a custom confidence threshold.
TextDetectionResult<T> DetectText(Tensor<T> image, double confidenceThreshold)
Parameters
imageTensor<T>The input image tensor.
confidenceThresholddoubleMinimum confidence for a detection (0-1).
Returns
- TextDetectionResult<T>
Detection result with text region locations.
GetProbabilityMap(Tensor<T>)
Gets the probability map showing text likelihood at each pixel.
Tensor<T> GetProbabilityMap(Tensor<T> image)
Parameters
imageTensor<T>The input image tensor.
Returns
- Tensor<T>
Probability map tensor with same spatial dimensions as input.