SaigeVision C/C++  1.4.7
SaigeVision API document for C/C++
CommonHeaderDLL.h
Go to the documentation of this file.
1 
4 #pragma once
5 #include <stdio.h>
6 
8 #define SAIGEVISION_MAJOR 1
9 
10 #define SAIGEVISION_MINOR 4
11 
12 #define SAIGEVISION_PATCHLEVEL 7
13 
14 #define SAIGEVISION_VERSION (SAIGEVISION_MAJOR * 1000 + SAIGEVISION_MINOR * 100 + SAIGEVISION_PATCHLEVEL)
15 
21 #define SR_USE_DEPRECATED_FUNCTIONS
22 
24 typedef enum
25 {
27  NO_LICENCE = 101,
32  NULL_INPUT = 106,
36  EMPTY_IMAGE = 110,
37  SMALL_IMAGE = 111,
44  UNKNOWN_ERROR = 1000,
45 } eErrorType;
46 
48 typedef enum
49 {
54  Detection_V1 = 10,
55  Detection_V2 = 11,
63  OCR_Box_V1 = 40,
64  OCR_Text_V1 = 41,
68 
70 typedef enum
71 {
84 } eHandlerType;
85 
87 typedef enum
88 {
93 
98 typedef enum
99 {
105 
107 typedef struct
108 {
110  unsigned int xCenter;
111 
113  unsigned int yCenter;
114 
116  unsigned int area;
117 
119  unsigned int width;
120 
122  unsigned int height;
123 
125  unsigned int classIdx;
126 
137  double scores[3];
138 
147  double averageColor[3];
148 
149 
164  void* croppedImage;
168  int nContours; /* number of contours */
169  int* nPointsOnContour; /* array of number of points on each contour (ex, nPointsOnContour[1]: # of points on the second contour)*/
170  int* pointsOnContour; /* array of x, y coordinates of all points on contours */
171 
176  int* hierarchies;
177 
179 
181 typedef struct
182 {
184  float x;
186  float y;
187 
189  float width;
191  float height;
192 
194  float x_tl;
196  float y_tl;
198  float x_br;
200  float y_br;
201 
203  float angle;
204 
206  float score;
208  int classIdx;
210 
212 typedef struct
213 {
216 
234 
236 typedef struct
237 {
240 
242  const wchar_t* wtext;
244  const char* text;
246 
247 static void PrintErrorType(eErrorType errorType, int verbosity = 2)
248 {
249  if (errorType == NO_ERROR_OUT)
250  {
251  if (verbosity >= 2)
252  {
253  printf("Saige Vision SUCCESS, NO_ERROR_OUT, %d \n", NO_ERROR_OUT);
254  }
255  }
256  else if (errorType == NO_LICENCE)
257  {
258  printf("Saige Vision FAILED, NO_LICENCE: KEY NOT FOUND, %d \n", NO_LICENCE);
259  }
260  else if (errorType == LOW_VERSION_LICENSE)
261  {
262  printf("Saige Vision FAILED, LOW_VERSION_LICENSE, %d \n", LOW_VERSION_LICENSE);
263  }
264  else if (errorType == NO_LICENSE_DONGLE)
265  {
266  printf("Saige Vision FAILED, NO_LICENSE_DONGLE: USB DONGLE NOT FOUND, %d \n", NO_LICENSE_DONGLE);
267  }
268  else if (errorType == USE_NOT_ALLOCATED_HANDLER)
269  {
270  printf("Saige Vision FAILED, USE_NOT_ALLOCATED_HANDLER, %d \n", USE_NOT_ALLOCATED_HANDLER);
271  }
272  else if (errorType == INAPPROPRIATE_HANDLER)
273  {
274  printf("Saige Vision FAILED, INAPPROPRIATE_HANDLER, %d \n", INAPPROPRIATE_HANDLER);
275  }
276  else if (errorType == OUT_OF_GPU_MEMORY)
277  {
278  printf("Saige Vision FAILED, OUT_OF_GPU_MEMORY, %d \n", OUT_OF_GPU_MEMORY);
279  }
280  else if (errorType == INAPPROPRIATE_GPU_NUMBER)
281  {
282  printf("Saige Vision FAILED, INAPPROPRIATE_GPU_NUMBER, %d \n", INAPPROPRIATE_GPU_NUMBER);
283  }
284  else if (errorType == NULL_INPUT)
285  {
286  printf("Saige Vision FAILED, NULL_INPUT, %d \n", NULL_INPUT);
287  }
288  else if (errorType == INAPPROPRIATE_INPUT)
289  {
290  printf("Saige Vision FAILED, INAPPROPRIATE_INPUT, %d \n", INAPPROPRIATE_INPUT);
291  }
292  else if (errorType == FILE_NOT_FOUND)
293  {
294  printf("Saige Vision FAILED, FILE_NOT_FOUND, %d \n", FILE_NOT_FOUND);
295  }
296  else if (errorType == NULL_HANDLE_FILE_PATH)
297  {
298  printf("Saige Vision FAILED, NULL_HANDLE_FILE_PATH, %d \n", NULL_HANDLE_FILE_PATH);
299  }
300  else if (errorType == EMPTY_IMAGE)
301  {
302  printf("Saige Vision FAILED, EMPTY_IMAGE, %d \n", EMPTY_IMAGE);
303  }
304  else if (errorType == SMALL_IMAGE)
305  {
306  printf("Saige Vision FAILED, SMALL_IMAGE, %d \n", SMALL_IMAGE);
307  }
308  else if (errorType == NOT_LOAD_NETWORK_IN_GPU)
309  {
310  printf("Saige Vision FAILED, NOT_LOAD_NETWORK_IN_GPU, %d \n", NOT_LOAD_NETWORK_IN_GPU);
311  }
312  else if (errorType == FORWARD_ALGO_TIMEOUT)
313  {
314  printf("Saige Vision FAILED, FORWARD_ALGO_TIMEOUT, %d \n", FORWARD_ALGO_TIMEOUT);
315  }
316  else if (errorType == INAPPROPRIATE_OUTPUT)
317  {
318  printf("Saige Vision FAILED, INAPPROPRIATE_OUTPUT, %d \n", INAPPROPRIATE_OUTPUT);
319  }
320  else if (errorType == LOW_VERSION_FILE)
321  {
322  printf("Saige Vision FAILED, LOW_VERSION_FILE, %d \n", LOW_VERSION_FILE);
323  }
324  else
325  {
326  printf("Saige Vision FAILED, UNKNOWN_ERROR, %d \n", UNKNOWN_ERROR);
327  }
328 }
329 
Classification_V3
@ Classification_V3
Definition: CommonHeaderDLL.h:52
SR_RotatedBox::y_tl
float y_tl
y coordinate of the top-left corner
Definition: CommonHeaderDLL.h:196
GenTrainType
@ GenTrainType
Definition: CommonHeaderDLL.h:78
OCRTrainType
@ OCRTrainType
Definition: CommonHeaderDLL.h:80
SR_OCRTextBox::text
const char * text
text information of a OCR object in multi-byte characters
Definition: CommonHeaderDLL.h:244
NO_LICENSE_DONGLE
@ NO_LICENSE_DONGLE
Definition: CommonHeaderDLL.h:42
ClsTrainType
@ ClsTrainType
Definition: CommonHeaderDLL.h:72
eAlgorithmType
eAlgorithmType
Enumerator indicating a type of model.
Definition: CommonHeaderDLL.h:49
OUT_OF_GPU_MEMORY
@ OUT_OF_GPU_MEMORY
Definition: CommonHeaderDLL.h:30
SR_RotatedBox
Structure describing features for a rotated rectangle.
Definition: CommonHeaderDLL.h:182
eModeOfCropLargeObjects
eModeOfCropLargeObjects
Enumerator indicating a mode of cropping large objects in segmentation.
Definition: CommonHeaderDLL.h:99
SR_CROP_CENTER_BY_CROPSIZE
@ SR_CROP_CENTER_BY_CROPSIZE
Definition: CommonHeaderDLL.h:102
SR_SegmentedObject::classIdx
unsigned int classIdx
class index of the object (except for background)
Definition: CommonHeaderDLL.h:125
Classification_V2
@ Classification_V2
Definition: CommonHeaderDLL.h:51
SR_SegmentedObject::height
unsigned int height
height of the object
Definition: CommonHeaderDLL.h:122
SR_DetectedBox::croppedImage
void * croppedImage
data of a cropped image
Definition: CommonHeaderDLL.h:231
SR_SegmentedObject
Struct describing features of a segmentation object.
Definition: CommonHeaderDLL.h:108
Segmentation_V3
@ Segmentation_V3
Definition: CommonHeaderDLL.h:59
INAPPROPRIATE_INPUT
@ INAPPROPRIATE_INPUT
Definition: CommonHeaderDLL.h:33
SR_RotatedBox::classIdx
int classIdx
index of the object's class
Definition: CommonHeaderDLL.h:208
NO_LICENCE
@ NO_LICENCE
Definition: CommonHeaderDLL.h:27
SR_SegmentedObject::croppedImageWidth
int croppedImageWidth
width of a cropped image
Definition: CommonHeaderDLL.h:158
Detection_V1
@ Detection_V1
Definition: CommonHeaderDLL.h:54
SR_RotatedBox::score
float score
feature score of the object (0 - 100)
Definition: CommonHeaderDLL.h:206
DefectGenerator_V1
@ DefectGenerator_V1
Definition: CommonHeaderDLL.h:61
NULL_HANDLE_FILE_PATH
@ NULL_HANDLE_FILE_PATH
Definition: CommonHeaderDLL.h:35
SegTrainType
@ SegTrainType
Definition: CommonHeaderDLL.h:76
SegTestType
@ SegTestType
Definition: CommonHeaderDLL.h:77
Segmentation_V1
@ Segmentation_V1
Definition: CommonHeaderDLL.h:57
eModeOfPixelSizeFilter
eModeOfPixelSizeFilter
Enumerator indicating a mode of filtering by object's area in segmentation.
Definition: CommonHeaderDLL.h:88
GenTestType
@ GenTestType
Definition: CommonHeaderDLL.h:79
SR_RotatedBox::angle
float angle
rotated angle of the object in degree (counter-clockwise)
Definition: CommonHeaderDLL.h:203
SR_SegmentedObject::nContours
int nContours
Definition: CommonHeaderDLL.h:168
USE_NOT_ALLOCATED_HANDLER
@ USE_NOT_ALLOCATED_HANDLER
Definition: CommonHeaderDLL.h:28
INAPPROPRIATE_GPU_NUMBER
@ INAPPROPRIATE_GPU_NUMBER
Definition: CommonHeaderDLL.h:31
SR_RotatedBox::x
float x
x coordinate of the center of the object
Definition: CommonHeaderDLL.h:184
NOT_LOAD_NETWORK_IN_GPU
@ NOT_LOAD_NETWORK_IN_GPU
Definition: CommonHeaderDLL.h:38
Classification_V1
@ Classification_V1
Definition: CommonHeaderDLL.h:50
LOW_VERSION_FILE
@ LOW_VERSION_FILE
Definition: CommonHeaderDLL.h:43
LOW_VERSION_LICENSE
@ LOW_VERSION_LICENSE
Definition: CommonHeaderDLL.h:41
SR_SegmentedObject::yCenter
unsigned int yCenter
y coordinate of the center of the object
Definition: CommonHeaderDLL.h:113
UNKNOWN_ERROR
@ UNKNOWN_ERROR
Definition: CommonHeaderDLL.h:44
SR_CROP_BY_OBJECTSIZE
@ SR_CROP_BY_OBJECTSIZE
Definition: CommonHeaderDLL.h:101
NULL_INPUT
@ NULL_INPUT
Definition: CommonHeaderDLL.h:32
SR_PIXELSIZE_FILTER_MODE_ON_EXACT
@ SR_PIXELSIZE_FILTER_MODE_ON_EXACT
Definition: CommonHeaderDLL.h:91
SMALL_IMAGE
@ SMALL_IMAGE
Definition: CommonHeaderDLL.h:37
SR_SegmentedObject::area
unsigned int area
area of the object
Definition: CommonHeaderDLL.h:116
SR_DetectedBox::croppedImageChannels
int croppedImageChannels
# of channels of a cropped image
Definition: CommonHeaderDLL.h:229
SR_SegmentedObject::xCenter
unsigned int xCenter
x coordinate of the center of the object
Definition: CommonHeaderDLL.h:110
ClsTestType
@ ClsTestType
Definition: CommonHeaderDLL.h:73
FORWARD_ALGO_TIMEOUT
@ FORWARD_ALGO_TIMEOUT
Definition: CommonHeaderDLL.h:39
SR_DetectedBox::box
SR_RotatedBox box
detected box
Definition: CommonHeaderDLL.h:215
EMPTY_IMAGE
@ EMPTY_IMAGE
Definition: CommonHeaderDLL.h:36
SR_DetectedBox::croppedImageHeight
int croppedImageHeight
height of a cropped image
Definition: CommonHeaderDLL.h:227
SR_RotatedBox::y
float y
y coordinate of the center of the object
Definition: CommonHeaderDLL.h:186
OCRTestType
@ OCRTestType
Definition: CommonHeaderDLL.h:81
INAPPROPRIATE_OUTPUT
@ INAPPROPRIATE_OUTPUT
Definition: CommonHeaderDLL.h:40
INAPPROPRIATE_HANDLER
@ INAPPROPRIATE_HANDLER
Definition: CommonHeaderDLL.h:29
SR_DetectedBox
Struct describing features of a detected box.
Definition: CommonHeaderDLL.h:213
SR_DetectedBox::croppedImageWidth
int croppedImageWidth
width of a cropped image
Definition: CommonHeaderDLL.h:225
SuperResolution_V1
@ SuperResolution_V1
Definition: CommonHeaderDLL.h:66
FILE_NOT_FOUND
@ FILE_NOT_FOUND
Definition: CommonHeaderDLL.h:34
SR_CROP_BY_OBJECTSIZE_NOT_SQUARE
@ SR_CROP_BY_OBJECTSIZE_NOT_SQUARE
Definition: CommonHeaderDLL.h:103
SR_RotatedBox::x_br
float x_br
x coordinate of the bottom-right corner
Definition: CommonHeaderDLL.h:198
DetTrainType
@ DetTrainType
Definition: CommonHeaderDLL.h:74
SuperResolutionTrainType
@ SuperResolutionTrainType
Definition: CommonHeaderDLL.h:82
eErrorType
eErrorType
Enumerator indicating error codes.
Definition: CommonHeaderDLL.h:25
SR_PIXELSIZE_FILTER_MODE_OFF
@ SR_PIXELSIZE_FILTER_MODE_OFF
Definition: CommonHeaderDLL.h:89
SR_RotatedBox::y_br
float y_br
y coordinate of the bottom-right corner
Definition: CommonHeaderDLL.h:200
SR_SegmentedObject::hierarchies
int * hierarchies
Array of hierarchies for all contours of segmented object.
Definition: CommonHeaderDLL.h:176
SR_OCRTextBox::box
SR_RotatedBox box
geometrical information of a OCR object
Definition: CommonHeaderDLL.h:239
SR_RotatedBox::x_tl
float x_tl
x coordinate of the top-left corner
Definition: CommonHeaderDLL.h:194
eHandlerType
eHandlerType
Enumerator indicating a type of handler.
Definition: CommonHeaderDLL.h:71
SR_OCRTextBox
Structure describing features of a OCR object.
Definition: CommonHeaderDLL.h:237
SR_PIXELSIZE_FILTER_MODE_ON_FAST
@ SR_PIXELSIZE_FILTER_MODE_ON_FAST
Definition: CommonHeaderDLL.h:90
OCR_Box_V1
@ OCR_Box_V1
Definition: CommonHeaderDLL.h:63
Segmentation_V2
@ Segmentation_V2
Definition: CommonHeaderDLL.h:58
SR_SegmentedObject::width
unsigned int width
width of the object
Definition: CommonHeaderDLL.h:119
SR_CROP_BY_OBJECTSIZE_N_RESIZE_TO_CROPSIZE
@ SR_CROP_BY_OBJECTSIZE_N_RESIZE_TO_CROPSIZE
Definition: CommonHeaderDLL.h:100
OCR_Text_V1
@ OCR_Text_V1
Definition: CommonHeaderDLL.h:64
SR_RotatedBox::height
float height
height of the object
Definition: CommonHeaderDLL.h:191
NO_ERROR_OUT
@ NO_ERROR_OUT
Definition: CommonHeaderDLL.h:26
Detection_V2
@ Detection_V2
Definition: CommonHeaderDLL.h:55
SR_SegmentedObject::croppedImage
void * croppedImage
data of a cropped image
Definition: CommonHeaderDLL.h:164
SR_SegmentedObject::croppedImageHeight
int croppedImageHeight
height of a cropped image
Definition: CommonHeaderDLL.h:160
SR_RotatedBox::width
float width
width of the object
Definition: CommonHeaderDLL.h:189
SuperResolutionTestType
@ SuperResolutionTestType
Definition: CommonHeaderDLL.h:83
SR_SegmentedObject::croppedImageChannels
int croppedImageChannels
# of channels of a cropped image
Definition: CommonHeaderDLL.h:162
SR_OCRTextBox::wtext
const wchar_t * wtext
text information of a OCR object in wide characters
Definition: CommonHeaderDLL.h:242
DetTestType
@ DetTestType
Definition: CommonHeaderDLL.h:75