콘텐츠로 이동

이미지 정렬 기능

이미지 정렬 기능

Public Functions

Type Name
int SaigeInitializeAlignModule (const int gpuIndex, const int sourceWidth, const int sourceHeight, const int targetWidth, const int targetHeight)
Saige Alignment 기능을 활성화하는 함수입니다.
int SaigeFinalizeAlignModule ()
Saige Alignment 기능을 종료하는 함수입니다. 기능에 사용된 GPU 메모리를 해제합니다.
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)
Source 이미지를 Target 이미지에 맞게 위치를 조정하여 Crop하는 함수입니다.
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)
SaigeAlignImageFromByteArray의 확장 버전으로, Source 이미지에 적용된 Crop 박스의 픽셀 좌표를 함께 반환합니다.
int SaigeAlignImageFromFile (const char * sourceImagePath, const char * targetImagePath, int * cropWidth, int * cropHeight, int * cropChannel, unsigned char * croppedSourceImage)
Not Implemented.

Public Functions Documentation

SaigeInitializeAlignModule

Saige Alignment 기능을 활성화하는 함수입니다.

int SaigeInitializeAlignModule (
    const int gpuIndex,
    const int sourceWidth,
    const int sourceHeight,
    const int targetWidth,
    const int targetHeight
) 

Alignment 기능은 Source 이미지를 Target 이미지에 맞게 위치를 조정하여 Crop하는 기능입니다. 따라서, Source 이미지가 Target 이미지보다 크기가 커야 합니다.

Parameters:

  • gpuIndex GPU를 사용하는 기능이며, 사용할 GPU의 인덱스입니다.
  • sourceWidth
  • sourceHeight
  • targetWidth
  • targetHeight

Returns:

errorCode 정상 작동 시 0을 리턴하고, 에러 발생 시 에러코드를 리턴합니다.

SaigeFinalizeAlignModule

Saige Alignment 기능을 종료하는 함수입니다. 기능에 사용된 GPU 메모리를 해제합니다.

int SaigeFinalizeAlignModule () 

Returns:

errorCode 정상 작동 시 0을 리턴하고, 에러 발생 시 에러코드를 리턴합니다.

SaigeAlignImageFromByteArray

Source 이미지를 Target 이미지에 맞게 위치를 조정하여 Crop하는 함수입니다.

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
) 

Source 이미지가 Target 이미지에 맞게 가로, 세로가 Crop되기 때문에 croppedSourceImage의 크기는 targetWidth * targetHeight * sourceChannel이어야 합니다.

Parameters:

  • sourceImage Source 이미지의 바이트 배열입니다.
  • sourceWidth Source 이미지의 너비입니다.
  • sourceHeight Source 이미지의 높이입니다.
  • sourceChannel Source 이미지의 채널입니다.
  • targetImage Target 이미지의 바이트 배열입니다.
  • targetWidht Target 이미지의 너비입니다.
  • targetHeight Target 이미지의 높이입니다.
  • targetChannel Target 이미지의 채널입니다.
  • flag Crop된 Source 이미지의 테두리를 검출할지 여부입니다.
  • croppedSourceImage Crop된 Source 이미지의 바이트 배열입니다.

Returns:

errorCode 정상 작동 시 0을 리턴하고, 에러 발생 시 에러코드를 리턴합니다.

SaigeAlignImageFromByteArrayWithCoord

SaigeAlignImageFromByteArray의 확장 버전으로, Source 이미지에 적용된 Crop 박스의 픽셀 좌표를 함께 반환합니다.

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
) 

정렬 및 Crop 동작은 SaigeAlignImageFromByteArray와 동일하며, 추가로 Source 이미지 좌표계 기준의 (x1, y1, x2, y2) Crop 박스를 cropCoords에 기록합니다. 기존 시그니처는 하위 호환을 위해 유지되며, 좌표가 필요할 때만 본 함수를 사용하면 됩니다.

Parameters:

  • cropCoords Source 이미지에 적용된 Crop 박스의 픽셀 좌표(x1, y1, x2, y2)를 담을 int[4] 배열입니다. 좌표가 필요 없다면 nullptr을 전달할 수 있습니다.

Returns:

errorCode 정상 작동 시 0을 리턴하고, 에러 발생 시 에러코드를 리턴합니다.

SaigeAlignImageFromFile

Not Implemented.

int SaigeAlignImageFromFile (
    const char * sourceImagePath,
    const char * targetImagePath,
    int * cropWidth,
    int * cropHeight,
    int * cropChannel,
    unsigned char * croppedSourceImage
)