DSTextZonesUnit
The DSTextZonesUnit
class extends the DSIntermediateResultUnit
class and represents a unit of text zones identified during the processing of an image. This class is used to encapsulate the locations of detected text areas within an image, providing a structured representation of where text is located.
Definition
Assembly: DynamsoftCore.xcframework
- Objective-C
- Swift
@interface DSTextZonesUnit: DSIntermediateResultUnit
class TextZonesUnit: IntermediateResultUnit
Methods
Method | Description |
---|---|
getTextZones |
Gets an array of DSTextZone objects, each representing the geometric boundaries of a detected text zone within the image. |
getCount |
Returns the number of text zones in this unit. |
getTextZone |
Returns the text zone at the specified index. |
removeTextZone |
Removes the text zone at the specified index. |
addTextZone |
Adds a text zone to this unit. |
setTextZone |
Sets the text zone at the specified index. |
Inherited Methods
The following methods are inherited from class DSIntermediateResultUnit
.
Method | Description |
---|---|
getHashId |
Gets the hash ID of the unit. The hash ID is the unique identifier for the intermediate result unit. |
getOriginalImageHashId |
Gets the hash ID of the original image associated with this unit. |
getOriginalImageTag |
Gets the tag associated with the original image. |
getType |
Gets the type of the intermediate result unit, defined by the enumeration IntermediateResultUnitType . |
getTransformMatrix |
Gets the transformation matrix via DSTransformMatrixType . |
clone |
Creates a copy of the intermediate result unit. |
replace |
Replaces the content of the intermediate result unit. |
getTextZones
Gets an array of DSTextZone
objects, each representing the geometric boundaries of a detected text zone within the image.
- Objective-C
- Swift
-(nullable NSArray<DSTextZone*>*)getTextZones;
func getTextZones() -> [TextZone]?
Return Value
An array of DSTextZone
objects.
getCount
Returns the number of text zones in this unit.
- Objective-C
- Swift
-(NSInteger)getCount;
func getCount() -> Int
Return Value
The number of text zones.
getTextZone
Returns the text zone at the specified index.
- Objective-C
- Swift
-(nullable DSTextZone*)getTextZone:(NSInteger)index;
func getTextZone(index: Int) -> TextZone?
Parameters
index
: The index of the text zone.
Return Value
Returns the text zone at the specified index.
removeTextZone
Removes the text zone at the specified index.
- Objective-C
- Swift
-(void)removeTextZone:(NSInteger)index;
func removeTextZone(index: Int)
Parameters
index
: The index of the text zone to be removed.
addTextZone
Adds a text zone to this unit.
- Objective-C
- Swift
-(NSInteger)addTextZone:(DSTextZone*)textZone matrixToOriginalImage:(CGAffineTransform)matrixToOriginalImage;
func addTextZone(_ textZone: TextZone, matrixToOriginalImage: CGAffineTransform) -> Int
Parameters
textZone
: The text zone to be added.
matrixToOriginalImage
: The transformation matrix from the original image to the text zone.
Return Value
Returns the ErrorCode
if failed. Otherwise, returns 0.
setTextZone
Sets the text zone at the specified index.
- Objective-C
- Swift
-(NSInteger)setTextZone:(NSInteger)index textZone:(DSTextZone*)textZone matrixToOriginalImage:(CGAffineTransform)matrixToOriginalImage;
func setTextZone(index: Int, textZone: TextZone, matrixToOriginalImage: CGAffineTransform) -> Int
Parameters
index
: The index of the text zone.
textZone
: The text zone to be set.
matrixToOriginalImage
: The transformation matrix from the original image to the text zone.
Return Value
Returns the ErrorCode
if failed. Otherwise, returns 0.