Image Alignment¶
Image Alignment.
Public Functions¶
| Type | Name |
|---|---|
| int | SaigeInitializeAlignModule (const int gpuIndex, const int sourceWidth, const int sourceHeight, const int targetWidth, const int targetHeight) Function to activate the Saige Alignment function. |
| int | SaigeFinalizeAlignModule () Function to terminate the Saige Alignment function. Releases the GPU memory used by the function. |
| int | SaigeAlignImageFromByteArray (const unsigned char * sourceImage, const int sourceWidth, const int sourceHeight, const int sourceChannel, const unsigned char * targetImage, const int targetWidht, const int targetHeight, const int targetChannel, unsigned int flag, unsigned char * croppedSourceImage) Function to adjust the position of the Source image to match the Target image. |
| int | SaigeAlignImageFromByteArrayWithCoord (const unsigned char * sourceImage, const int sourceWidth, const int sourceHeight, const int sourceChannel, const unsigned char * targetImage, const int targetWidht, const int targetHeight, const int targetChannel, unsigned int flag, unsigned char * croppedSourceImage, int * cropCoords) Extended variant of SaigeAlignImageFromByteArray that also returns the pixel coordinates of the crop box applied to the Source image. |
| int | SaigeAlignImageFromFile (const char * sourceImagePath, const char * targetImagePath, int * cropWidth, int * cropHeight, int * cropChannel, unsigned char * croppedSourceImage) Not Implemented. |
Public Functions Documentation¶
SaigeInitializeAlignModule¶
Function to activate the Saige Alignment function.
int SaigeInitializeAlignModule (
const int gpuIndex,
const int sourceWidth,
const int sourceHeight,
const int targetWidth,
const int targetHeight
)
The Alignment function adjusts the position of the Source image to match the Target image and Crop it. Therefore, the Source image must be larger than the Target image.
Parameters:
gpuIndexThis function uses the GPU, and is the index of the GPU to use.sourceWidthsourceHeighttargetWidthtargetHeight
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeFinalizeAlignModule¶
Function to terminate the Saige Alignment function. Releases the GPU memory used by the function.
int SaigeFinalizeAlignModule ()
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeAlignImageFromByteArray¶
Function to adjust the position of the Source image to match the Target image.
int SaigeAlignImageFromByteArray (
const unsigned char * sourceImage,
const int sourceWidth,
const int sourceHeight,
const int sourceChannel,
const unsigned char * targetImage,
const int targetWidht,
const int targetHeight,
const int targetChannel,
unsigned int flag,
unsigned char * croppedSourceImage
)
The croppedSourceImage should be targetWidth * targetHeight * sourceChannel
Parameters:
sourceImageThe byte array of the Source image.sourceWidthThe width of the Source image.sourceHeightThe height of the Source image.sourceChannelThe channel of the Source image.targetImageThe byte array of the Target image.targetWidhtThe width of the Target image.targetHeightThe height of the Target image.targetChannelThe channel of the Target image.flagWhether to detect the edges of the cropped Source image.croppedSourceImageThe byte array of the cropped Source image.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeAlignImageFromByteArrayWithCoord¶
Extended variant of SaigeAlignImageFromByteArray that also returns the pixel coordinates of the crop box applied to the Source image.
int SaigeAlignImageFromByteArrayWithCoord (
const unsigned char * sourceImage,
const int sourceWidth,
const int sourceHeight,
const int sourceChannel,
const unsigned char * targetImage,
const int targetWidht,
const int targetHeight,
const int targetChannel,
unsigned int flag,
unsigned char * croppedSourceImage,
int * cropCoords
)
Alignment and cropping behave identically to SaigeAlignImageFromByteArray; additionally, the (x1, y1, x2, y2) crop box in Source-image coordinates is written to cropCoords. The legacy symbol is kept for backward compatibility — use this variant only when coordinates are required.
Parameters:
cropCoordsAn int[4] output array that receives the pixel coordinates of the crop box (x1, y1, x2, y2). Passnullptrif the coordinates are not needed.
Returns:
errorCode Returns 0 on success, or an error code if there is a failure.
SaigeAlignImageFromFile¶
Not Implemented.
int SaigeAlignImageFromFile (
const char * sourceImagePath,
const char * targetImagePath,
int * cropWidth,
int * cropHeight,
int * cropChannel,
unsigned char * croppedSourceImage
)