util functions¶
util functions
Public Functions¶
| Type | Name |
|---|---|
| void | SaigeInitTextFormatting (SaigeTextFormatting * formatting) SaigeInitTextFormatting. |
| unsigned int | SaigeConvertImageType (const int channel, const int type) SaigeConvertImageType. |
| int | SaigeOverlaySegmentedObjects (const void * baseImage, const SaigeSegmentedObject * objects, SaigeModelInfo * modelInfo, const int numOfSegmentedObjects, const int width, const int height, const int channels, const int type, const bool isRGB, const double overlayAlpha, void * resultImage) SaigeOverlaySegmentedObjects. |
| int | SaigeOverlayDetectedObjects (const void * baseImage, const SaigeDetectedObject * objects, SaigeModelInfo * modelInfo, const int numOfDetectedObjects, const int width, const int height, const int channels, const int type, const bool withClassName, const bool isRGB, const double overlayAlpha, void * resultImage) SaigeOverlayDetectedObjects. |
| int | SaigeOverlayTextObjects (const void * baseImage, const SaigeTextObject * objects, const int numOfTextObjects, const int width, const int height, const int channels, const int type, const bool isRGB, const double overlayAlpha, const double textScale, void * resultImage) SaigeOverlayTextObjects. |
| int | SaigeOverlayHeatmap (const void * baseImage, const float * heatmap, const int width, const int height, const int channels, const int type, const bool isRGB, const double overlayAlpha, void * resultImage) SaigeOverlayHeatmaps. |
| int | SaigeShowImage (const void * image, const int width, const int height, const int channels, const int type, const bool isRGB, const bool invert, const double alpha, const int waitMS) SaigeShowImage. |
Public Functions Documentation¶
SaigeInitTextFormatting¶
SaigeInitTextFormatting.
void SaigeInitTextFormatting (
SaigeTextFormatting * formatting
)
Initializes the boolean array indicating the inclusion of character sets in the given SaigeTextFormatting to false for all values. This prepares the formatting settings for use in text recognition tasks.
Parameters:
formattingPointer to the variable to be set.
SaigeConvertImageType¶
SaigeConvertImageType.
unsigned int SaigeConvertImageType (
const int channel,
const int type
)
Converts the number of channels and SaigeImageType into the image flag macro used in SaigeInferFromByteArray. This function is useful for preparing image data for inference.
Parameters:
channelThe number of channels in the image.typeThe data type of the image. Refer to SaigeDrawImage for setting options.
Returns:
imageFlag Returns the converted image flag macro.
SaigeOverlaySegmentedObjects¶
SaigeOverlaySegmentedObjects.
int SaigeOverlaySegmentedObjects (
const void * baseImage,
const SaigeSegmentedObject * objects,
SaigeModelInfo * modelInfo,
const int numOfSegmentedObjects,
const int width,
const int height,
const int channels,
const int type,
const bool isRGB,
const double overlayAlpha,
void * resultImage
)
Draws segmented objects on a base image and stores the result in an output image. This function allows for the visualization of segmentation results overlaid on an original image.
Parameters:
baseImageThe base image data on which segmented objects will be drawn.objectsThe array of segmented objects detected from inference.modelInfoThe model information, used for class colors; if null, the color red will be used.numOfSegmentedObjectsThe number of segmented objects.widthThe width of the base and result images.heightThe height of the base and result images.channelsThe number of channels in the base and result images.typeThe type of the image. Refer to SaigeImageType for details.overlayAlphaThe transparency value for visualizing segmented objects; the range is 0 to 1, where values closer to 1 make the segmented objects more transparent.resultImage[out] The image data that stores the result with segmented objects drawn on it.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
See also: SaigeGetInferenceResultNumOfSegmentedObjects, SaigeGetInferenceResultSegmentedObjects
SaigeOverlayDetectedObjects¶
SaigeOverlayDetectedObjects.
int SaigeOverlayDetectedObjects (
const void * baseImage,
const SaigeDetectedObject * objects,
SaigeModelInfo * modelInfo,
const int numOfDetectedObjects,
const int width,
const int height,
const int channels,
const int type,
const bool withClassName,
const bool isRGB,
const double overlayAlpha,
void * resultImage
)
Draws the bounding boxes of detected objects on a base image and stores the result in an output image. This function allows for the visualization of detection results overlaid on an original image.
Parameters:
baseImageThe base image data on which detected objects will be drawn.objectsThe array of detected objects from inference.modelInfoThe model information, used for class names and colors; if null, the color red will be used.numOfDetectedObjectsThe number of detected objects.widthThe width of the base and result images.heightThe height of the base and result images.channelsThe number of channels in the base and result images.typeThe type of the image. Refer to SaigeImageType for details.withClassNameIf set totrue, the class name of each detected object will also be displayed.isRGBIf set totrue, indicates that the image data is in RGB order.overlayAlphaThe transparency value for visualizing detected objects; the range is 0 to 1, where values closer to 1 make the detected objects more transparent.resultImage[out] The image data that stores the result with detected objects drawn on it.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
See also: SaigeGetInferenceResultNumOfDetectedObjects, SaigeGetInferenceResultDetectedObjects
SaigeOverlayTextObjects¶
SaigeOverlayTextObjects.
int SaigeOverlayTextObjects (
const void * baseImage,
const SaigeTextObject * objects,
const int numOfTextObjects,
const int width,
const int height,
const int channels,
const int type,
const bool isRGB,
const double overlayAlpha,
const double textScale,
void * resultImage
)
Draws the OCR results, represented by SaigeTextObject, on a base image and stores the result in an output image. Currently, Korean text appears as '?', support for it is planned for future updates.
Parameters:
baseImageThe base image data on which SaigeTextObject will be drawn.objectsThe array of SaigeTextObject detected from inference.numOfSaigeTextObjectThe number of SaigeTextObject.widthThe width of the base and result images.heightThe height of the base and result images.channelsThe number of channels in the base and result images.typeThe type of the image. Refer to SaigeImageType for details.isRGBIf set totrue, indicates that the image data is in RGB order.overlayAlphaThe transparency value for visualizing SaigeTextObject; the range is 0 to 1, where values closer to 1 make the SaigeTextObject more transparent.resultImage[out] The image data that stores the result with SaigeTextObject drawn on it.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
See also: SaigeGetInferenceResultNumOfSaigeTextObject, SaigeGetInferenceResultSaigeTextObject
SaigeOverlayHeatmap¶
SaigeOverlayHeatmaps.
int SaigeOverlayHeatmap (
const void * baseImage,
const float * heatmap,
const int width,
const int height,
const int channels,
const int type,
const bool isRGB,
const double overlayAlpha,
void * resultImage
)
Draws a colorized heatmap on a base image and stores the result in an output image. This function helps visualize the heatmap data in relation to the original image.
Parameters:
baseImageThe base image data on which the heatmap will be drawn.heatmapThe array of heatmap data obtained from the inspection results.widthThe width of the base and result images.heightThe height of the base and result images.channelsThe number of channels in the base and result images.typeThe type of the image. Refer to SaigeImageType for details.isRGBIf set totrue, indicates that the image data is in RGB order.overlayAlphaThe transparency value for visualizing the heatmap; the range is 0 to 1, where values closer to 1 make the heatmap more transparent.resultImage[out] The image data that stores the result with the heatmap drawn on it.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
See also: SaigeGetInferenceResultHeatmap
SaigeShowImage¶
SaigeShowImage.
int SaigeShowImage (
const void * image,
const int width,
const int height,
const int channels,
const int type,
const bool isRGB,
const bool invert,
const double alpha,
const int waitMS
)
Displays an image in a separate window. This function is useful for visualizing images during development or debugging processes.
Parameters:
imageThe image data to be displayed.widthThe width of the image.heightThe height of the image.channelsThe number of channels in the image.typeThe data type of the image. Refer to SaigeImageType for setting options.isRGBIf set totrue, indicates that the image data is in RGB order.invertIf set totrue, the colors will be inverted during display.alphaThe value multiplied with the pixel values of the image data; this helps adjust the brightness of the displayed image.waitMSThe display duration in milliseconds; if set to 0, the display window must be closed manually.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.