ComPDF Objective-C SDK
API Reference Documentation for ComPDF Objective-C SDK
Loading...
Searching...
No Matches
document_ai.h
1#import "base_type.h"
2#import <Foundation/Foundation.h>
3
4
5
6
7NS_ASSUME_NONNULL_BEGIN
8
13@interface LayoutAnalysisResult : NSObject
14
16@property (nonatomic, copy) NSString *label;
18@property (nonatomic, assign) float score;
20@property (nonatomic, strong) NSArray *rect;
21
22
23@end
24
29@interface StampDetectionResult : NSObject
30
32@property (nonatomic, copy) NSString *label;
34@property (nonatomic, assign) float score;
36@property (nonatomic, strong) NSArray *rect;
37
38
39@end
40
45@interface CLine : NSObject
46
48@property (nonatomic, assign) int startX;
50@property (nonatomic, assign) int startY;
52@property (nonatomic, assign) int endX;
54@property (nonatomic, assign) int endY;
55
56@end
57
62@interface CRect : NSObject
64@property (nonatomic, assign) int left;
66@property (nonatomic, assign) int top;
68@property (nonatomic, assign) int right;
70@property (nonatomic, assign) int bottom;
71@end
72
73
78@interface CTextLine : NSObject
80@property (nonatomic, assign) float score;
82@property (nonatomic, assign) int textLength;
84@property (nonatomic, copy) NSString *text;
86@property (nonatomic, strong) CRect *bbox;
87@end
88
93@interface CTABResult : NSObject
94
96@property (nonatomic, assign) int num;
98@property (nonatomic, assign) int rowCount;
100@property (nonatomic, assign) int colCount;
102@property (nonatomic, assign) int angle;
104@property (nonatomic, assign) int score;
106@property (nonatomic, copy) NSString *type;
108@property (nonatomic, strong) NSArray *rect;
110@property (nonatomic, strong) NSArray *heightOfRows;
112@property (nonatomic, strong) NSArray *widthOfCols;
114@property (nonatomic, strong) NSArray<NSArray<CTextLine *> *> *cellsText;
116@property (nonatomic, strong) NSArray<CLine *> *horizonLines;
118@property (nonatomic, strong) NSArray<CLine *> *verticalLines;
120@property (nonatomic, strong) NSArray *cells; // NSArray<CTableCell*>
122@property (nonatomic, copy) NSString *jsonStr;
124@property (nonatomic, copy) NSString *htmlStr;
125
126@end
127
128
129
134@interface CTableCell : NSObject
136@property (nonatomic, assign) int startRow;
138@property (nonatomic, assign) int endRow;
140@property (nonatomic, assign) int startCol;
142@property (nonatomic, assign) int endCol;
144@property (nonatomic, assign) int textLength;
146@property (nonatomic, assign) int lineCount;
148@property (nonatomic, assign) int cellBackgroundColorR;
150@property (nonatomic, assign) int cellBackgroundColorG;
152@property (nonatomic, assign) int cellBackgroundColorB;
153
155@property (nonatomic, copy) NSString *text;
157@property (nonatomic, strong) NSArray<CTextLine *> *lines;
159@property (nonatomic, strong) CRect *bbox;
160@end
161
162
167@interface COCRResult : NSObject
168
170@property (nonatomic, copy) NSString *text;
172@property (nonatomic, assign) float score;
174@property (nonatomic, strong) NSArray *rect;
175@end
176
181@interface CMAGICCOLORResult : NSObject
182
184@property (nonatomic, strong) NSImage *image;
185
186@end
187
192@interface CDEWARPResult : NSObject
193
195@property (nonatomic, strong) NSArray *points;
197@property (nonatomic, strong) NSImage *image;
198
199@end
200
201
202
207@interface CPDFDocumentAI : NSObject
208
215+ (ErrorCode)LayoutAnalysis:(id)input andResults:(NSMutableArray<LayoutAnalysisResult*> *)LayoutResult;
216
223+ (ErrorCode)StampDetection:(id)input andResults:(NSMutableArray<StampDetectionResult*> *)StampResult;
224
231+ (ErrorCode)Ocr:(id)input andResult:(NSMutableArray<COCRResult*> *)ocrResult;
232
239+ (ErrorCode)MagicColor:(id)input andOutputImage:(CMAGICCOLORResult*)outputImage;
240
248+ (ErrorCode)Dewarp:(id)input andOutputImage:(CDEWARPResult*)outputImage;
249
256+ (ErrorCode)TableRec:(id)input andResult:(NSMutableArray<CTABResult*>*)tabResult;
257
258
259
260@end
261
262
263NS_ASSUME_NONNULL_END
Dewarp output including key points and the corrected image.
NSArray * points
Corner points as 8 integers [tl.x,tl.y,tr.x,tr.y,bl.x,bl.y,br.x,br.y].
NSImage * image
Dewarped/corrected image.
A 2D line segment.
Definition document_ai.h:46
int startY
Y coordinate of start point.
Definition document_ai.h:50
int endY
Y coordinate of end point.
Definition document_ai.h:54
int startX
X coordinate of start point.
Definition document_ai.h:48
int endX
X coordinate of end point.
Definition document_ai.h:52
Image result of MagicColor enhancement.
NSImage * image
Output enhanced image.
Single OCR token/line result.
float score
Confidence score in range [0,1].
NSString * text
Recognized text content.
NSArray * rect
Quadrilateral as 8 integers [x0,y0,x1,y1,x2,y2,x3,y3].
High-level APIs for Document AI tasks.
A rectangle defined by four edges.
Definition document_ai.h:63
int top
Top edge (inclusive).
Definition document_ai.h:66
int right
Right edge (exclusive or inclusive by context).
Definition document_ai.h:68
int bottom
Bottom edge (exclusive or inclusive by context).
Definition document_ai.h:70
int left
Left edge (inclusive).
Definition document_ai.h:64
Table recognition result for a page.
Definition document_ai.h:94
int colCount
Column count of the table.
NSString * jsonStr
Table content in JSON format.
int score
Confidence score.
NSArray * rect
Table bounding box as [left, top, right, bottom].
NSArray * heightOfRows
Height for each row.
NSString * type
Table type label.
NSArray * cells
Table cells list.
NSArray< NSArray< CTextLine * > * > * cellsText
Recognized text lines for each cell, organized by [row][col].
NSArray< CLine * > * horizonLines
Horizontal grid lines of the table.
int angle
Table rotation angle (degree).
NSString * htmlStr
Table content in HTML format.
int num
Table index on the page (0-based).
Definition document_ai.h:96
NSArray< CLine * > * verticalLines
Vertical grid lines of the table.
NSArray * widthOfCols
Width for each column.
int rowCount
Row count of the table.
Definition document_ai.h:98
A single table cell with text and geometry.
int startCol
Starting column index (inclusive).
NSArray< CTextLine * > * lines
Recognized lines in the cell.
int cellBackgroundColorR
Cell background Red [0..255].
CRect * bbox
Cell bounding box.
int cellBackgroundColorG
Cell background Green [0..255].
int cellBackgroundColorB
Cell background Blue [0..255].
NSString * text
Cell text content.
int lineCount
Line count inside the cell.
int startRow
Starting row index (inclusive).
int endRow
Ending row index (inclusive).
int textLength
Text length in the cell.
int endCol
Ending column index (inclusive).
A recognized text line with bounding box.
Definition document_ai.h:79
int textLength
Text length (character count).
Definition document_ai.h:82
CRect * bbox
Bounding box of the text line as [left, top, right, bottom].
Definition document_ai.h:86
float score
Confidence score in range [0,1].
Definition document_ai.h:80
NSString * text
Recognized text content (UTF-8).
Definition document_ai.h:84
Single layout element detected on a page.
Definition document_ai.h:14
NSString * label
Detected label/type name.
Definition document_ai.h:16
float score
Confidence score in range [0,1].
Definition document_ai.h:18
NSArray * rect
Bounding box as [left, top, right, bottom].
Definition document_ai.h:20
Single stamp/seal detected on a page.
Definition document_ai.h:30
NSString * label
Detected label/type name.
Definition document_ai.h:32
float score
Confidence score in range [0,1].
Definition document_ai.h:34
NSArray * rect
Bounding box as [left, top, right, bottom].
Definition document_ai.h:36