Inference¶
Inference.
Public Functions¶
| Type | Name |
|---|---|
| int | SaigeInferFromImageFile (SaigeInferenceHandle handle, const char * imagePath, SaigeInferenceResult result) Performs inference using the specified image file path. |
| int | SaigeInferFromByteArray (SaigeInferenceHandle handle, const unsigned char * imageData, const int width, const int height, const unsigned int flags, SaigeInferenceResult result) Performs inference on a single image data array. For 3-channel color images, RGB ordering is preferred for speed in real-time applications. If images are acquired in RGB, it is recommended to use RGB. |
| int | SaigeInferFromByteArrayWithProductId (SaigeInferenceHandle handle, const unsigned char * imageData, const int width, const int height, const unsigned int flags, const char * productId, SaigeInferenceResult result) Performs inference on a single image data array with an additional product identifier. This is similar to SaigeInferFromByteArray, with the addition of a product ID, which is a user-defined identifier for the inspection target. |
| int | SaigeInferFromMultipleByteArray (SaigeInferenceHandle handle, const int numOfImages, const unsigned char ** imageData, const int width, const int height, const unsigned int flags, SaigeInferenceResult * results) Performs batch inference on multiple images of the same size. |
Macros¶
| Type | Name |
|---|---|
| define | SAIGE_IMAGE_COLOR 0x01 Flag indicating color image data. |
| define | SAIGE_IMAGE_16BIT 0x02 Flag indicating 16-bit per channel image data. |
| define | SAIGE_IMAGE_ALPHA 0x04 Flag indicating data with an alpha channel. |
| define | SAIGE_IMAGE_BGR 0x08 Flag indicating the color channel order is Blue, Green, Red. |
| define | SAIGE_IMAGE_8BIT_GRAY 0x00 Macro indicating 8-bit grayscale image data. It is a single-channel array with a size of Width x Height. |
| define | SAIGE_IMAGE_24BIT_RGB (SAIGE_IMAGE_COLOR) Macro indicating 24-bit RGB color image data. It is an array of size Width x Height x Channels (3) with channels ordered as R, G, B. |
| define | SAIGE_IMAGE_24BIT_BGR (SAIGE_IMAGE_COLOR | SAIGE_IMAGE_BGR) Macro indicating 24-bit BGR color image data. It is an array of size Width x Height x Channels (3) with channels ordered as B, G, R. |
| define | SAIGE_IMAGE_32BIT_RGBA (SAIGE_IMAGE_COLOR | SAIGE_IMAGE_ALPHA) Macro indicating 32-bit RGBA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as R, G, B, A. |
| define | SAIGE_IMAGE_32BIT_BGRA (SAIGE_IMAGE_COLOR | SAIGE_IMAGE_ALPHA | SAIGE_IMAGE_BGR) Macro indicating 32-bit BGRA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as B, G, R, A. |
| define | SAIGE_IMAGE_16BIT_GRAY (SAIGE_IMAGE_16BIT) Macro indicating 16-bit grayscale image data. It is a single-channel array of size Width x Height, with each pixel represented as an unsigned short. |
| define | SAIGE_IMAGE_48BIT_RGB (SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT) Macro indicating 48-bit RGB color image data. It is an array of size Width x Height x Channels (3) with channels ordered as R, G, B, and each pixel represented as an unsigned short. |
| define | SAIGE_IMAGE_48BIT_BGR (SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT | SAIGE_IMAGE_BGR) Macro indicating 48-bit BGR color image data. It is an array of size Width x Height x Channels (3) with channels ordered as B, G, R, and each pixel represented as an unsigned short. |
| define | SAIGE_IMAGE_64BIT_RGBA (SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT | SAIGE_IMAGE_ALPHA) Macro indicating 64-bit RGBA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as R, G, B, A, and each pixel represented as an unsigned short. |
| define | SAIGE_IMAGE_64BIT_BGRA (SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT | SAIGE_IMAGE_ALPHA | SAIGE_IMAGE_BGR) Macro indicating 64-bit BGRA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as B, G, R, A, and each pixel represented as an unsigned short. |
Public Functions Documentation¶
SaigeInferFromImageFile¶
Performs inference using the specified image file path.
int SaigeInferFromImageFile (
SaigeInferenceHandle handle,
const char * imagePath,
SaigeInferenceResult result
)
Parameters:
handleThe inference handle to use for inference.imagePathPath to the image file for inference. Supported extensions arejpg,jpeg,png,ppm,bmp,pgm,tif,tiff, andwebp.resultThe result handle to store the inference results.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeInferFromByteArray¶
Performs inference on a single image data array. For 3-channel color images, RGB ordering is preferred for speed in real-time applications. If images are acquired in RGB, it is recommended to use RGB.
int SaigeInferFromByteArray (
SaigeInferenceHandle handle,
const unsigned char * imageData,
const int width,
const int height,
const unsigned int flags,
SaigeInferenceResult result
)
Parameters:
handleThe inference handle to use.imageDataThe image data to be used for inference.widthWidth of the image data.heightHeight of the image data.flagsFlags to set the color and bit depth of the image.resultThe result handle to store inference results.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
See also: SAIGE_IMAGE_8BIT_GRAY, SAIGE_IMAGE_24BIT_RGB
SaigeInferFromByteArrayWithProductId¶
Performs inference on a single image data array with an additional product identifier. This is similar to SaigeInferFromByteArray, with the addition of a product ID, which is a user-defined identifier for the inspection target.
int SaigeInferFromByteArrayWithProductId (
SaigeInferenceHandle handle,
const unsigned char * imageData,
const int width,
const int height,
const unsigned int flags,
const char * productId,
SaigeInferenceResult result
)
Parameters:
handleThe inference handle to use.imageDataThe image data to be used for inference.widthWidth of the image data.heightHeight of the image data.flagsFlags to set the color and bit depth of the image.productIdThe product ID for the item to be inferred.resultThe result handle to store inference results.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
See also: SAIGE_IMAGE_8BIT_GRAY, SAIGE_IMAGE_24BIT_RGB
SaigeInferFromMultipleByteArray¶
Performs batch inference on multiple images of the same size.
int SaigeInferFromMultipleByteArray (
SaigeInferenceHandle handle,
const int numOfImages,
const unsigned char ** imageData,
const int width,
const int height,
const unsigned int flags,
SaigeInferenceResult * results
)
Parameters:
handleThe inference handle to use.numOfImagesNumber of images in the data.imageDataArray of image data for inference.widthWidth of the image data.heightHeight of the image data.flagsFlags to set the color and bit depth of the image.resultsArray of result handles to store inference results.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
See also: SAIGE_IMAGE_24BIT_RGB, SaigeHandleConfig::batchSize
Macro Definition Documentation¶
SAIGE_IMAGE_COLOR¶
Flag indicating color image data.
#define SAIGE_IMAGE_COLOR 0x01
SAIGE_IMAGE_16BIT¶
Flag indicating 16-bit per channel image data.
#define SAIGE_IMAGE_16BIT 0x02
SAIGE_IMAGE_ALPHA¶
Flag indicating data with an alpha channel.
#define SAIGE_IMAGE_ALPHA 0x04
SAIGE_IMAGE_BGR¶
Flag indicating the color channel order is Blue, Green, Red.
#define SAIGE_IMAGE_BGR 0x08
SAIGE_IMAGE_8BIT_GRAY¶
Macro indicating 8-bit grayscale image data. It is a single-channel array with a size of Width x Height.
#define SAIGE_IMAGE_8BIT_GRAY 0x00
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_24BIT_RGB¶
Macro indicating 24-bit RGB color image data. It is an array of size Width x Height x Channels (3) with channels ordered as R, G, B.
#define SAIGE_IMAGE_24BIT_RGB ( SAIGE_IMAGE_COLOR )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_24BIT_BGR¶
Macro indicating 24-bit BGR color image data. It is an array of size Width x Height x Channels (3) with channels ordered as B, G, R.
#define SAIGE_IMAGE_24BIT_BGR ( SAIGE_IMAGE_COLOR | SAIGE_IMAGE_BGR )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_32BIT_RGBA¶
Macro indicating 32-bit RGBA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as R, G, B, A.
#define SAIGE_IMAGE_32BIT_RGBA ( SAIGE_IMAGE_COLOR | SAIGE_IMAGE_ALPHA )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_32BIT_BGRA¶
Macro indicating 32-bit BGRA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as B, G, R, A.
#define SAIGE_IMAGE_32BIT_BGRA ( SAIGE_IMAGE_COLOR | SAIGE_IMAGE_ALPHA | SAIGE_IMAGE_BGR )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_16BIT_GRAY¶
Macro indicating 16-bit grayscale image data. It is a single-channel array of size Width x Height, with each pixel represented as an unsigned short.
#define SAIGE_IMAGE_16BIT_GRAY ( SAIGE_IMAGE_16BIT )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_48BIT_RGB¶
Macro indicating 48-bit RGB color image data. It is an array of size Width x Height x Channels (3) with channels ordered as R, G, B, and each pixel represented as an unsigned short.
#define SAIGE_IMAGE_48BIT_RGB ( SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_48BIT_BGR¶
Macro indicating 48-bit BGR color image data. It is an array of size Width x Height x Channels (3) with channels ordered as B, G, R, and each pixel represented as an unsigned short.
#define SAIGE_IMAGE_48BIT_BGR ( SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT | SAIGE_IMAGE_BGR )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_64BIT_RGBA¶
Macro indicating 64-bit RGBA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as R, G, B, A, and each pixel represented as an unsigned short.
#define SAIGE_IMAGE_64BIT_RGBA ( SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT | SAIGE_IMAGE_ALPHA )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray
SAIGE_IMAGE_64BIT_BGRA¶
Macro indicating 64-bit BGRA color image data. It is an array of size Width x Height x Channels (4) with channels ordered as B, G, R, A, and each pixel represented as an unsigned short.
#define SAIGE_IMAGE_64BIT_BGRA ( SAIGE_IMAGE_COLOR | SAIGE_IMAGE_16BIT | SAIGE_IMAGE_ALPHA | SAIGE_IMAGE_BGR )
See also: SaigeInferFromByteArray, SaigeInferFromMultipleByteArray