SaigeVision C/C++ 1.5.0
SaigeVision API document for C/C++
 
Loading...
Searching...
No Matches
SegmentationTestDLL.h File Reference

Header file for segmentation module. More...

#include "CommonHeaderDLL.h"

Go to the source code of this file.

Typedefs

typedef void * SegTestHandle
 Segmentation file handler. More...
 
typedef void * SegTestResult
 Segmentation inspection results handler. More...
 

Enumerations

enum  eSegTestOutputType { SR_ONE_CLASS_MATRIX_OUTPUT = 0 , SR_MULTI_CLASS_MATRIX_OUTPUT = 1 , SR_ONE_CLASS_CV_CONTOUR_OUTPUT = 2 , SR_MULTI_CLASS_CV_CONTOUR_OUTPUT = 3 , SR_MULTI_CLASS_HEATMAP_OUTPUT = 4 , SR_MULTI_CLASS_ARRAY_OUTPUT = 5 }
 Segmentation output type. More...
 

Functions

SegTestHandle SR_CreateSegTestHandle (const char *filePath)
 Create a SegTestHandle via multi byte char path. More...
 
eErrorType SR_CreateSegTestHandle_ErrorType (SegTestHandle *segTestHandle, const char *filePath)
 Create a SegTestHandle via multi byte char path. More...
 
SegTestHandle SR_CreateSegTestHandleByWideCharPath (const wchar_t *filePath)
 Create a SegTestHandle via wide char path. More...
 
eErrorType SR_CreateSegTestHandleByWideCharPath_ErrorType (SegTestHandle *segTestHandle, const wchar_t *filePath)
 Create a SegTestHandle via wide char path. More...
 
SegTestResult SR_MakeSegTestResult ()
 Construct a SegTestResult. More...
 
eErrorType SR_MakeSegTestResult_ErrorType (SegTestResult *segTestResult)
 Construct a SegTestResult. More...
 
eErrorType SR_LoadSegTestNetworkInGPU (SegTestHandle handle, int GPUNumber, int batchSize=1)
 Allocate required cpu & gpu memory. More...
 
eErrorType SR_GetSegTestAlgorithmType (SegTestHandle handle, eAlgorithmType *algoType)
 Get a algorithm type(ex, standard, deep) of a segmentation model.
 
eErrorType SR_PrintSegTestParametersWithoutBG (SegTestHandle handle)
 Print a model parameters (Segmentation's class information, inspection options...)
 
eErrorType SR_GetSegTestNumberOfClassesWithoutBG (SegTestHandle handle, int *numberOfClasses)
 Get the number of classes. More...
 
eErrorType SR_GetSegTestMaxStrLenOfClassName (SegTestHandle handle, int *len)
 Get a maximum length of class name. More...
 
eErrorType SR_GetSegTestOneClassNameWithWideCharByIdxWithoutBG (SegTestHandle handle, const int classIdx, wchar_t *className)
 Get a wide char name of certain class by given index. More...
 
eErrorType SR_GetSegTestOneClassNameWithMultiByteCharByIdxWithoutBG (SegTestHandle handle, const int classIdx, char *className)
 Get a multi byte char name of certain class by given index. More...
 
eErrorType SR_GetSegTestOneClassColorByIdxWithoutBG (SegTestHandle handle, const int classIdx, int *classColor)
 Get a color of certain class by given index. More...
 
eErrorType SR_GetSegTrainedVersion (SegTestHandle handle, int *trainedVersionMajor, int *trainedVersionMinor, int *trainedVersionPatch)
 Get a trained version of model file, -1 means before v1.4.8. More...
 
eErrorType SR_GetSegTestMinScoreThresholdWithoutBG (SegTestHandle handle, int *scoreThreshold)
 Get Segmentation's score threshold for each class. More...
 
eErrorType SR_SetSegTestMinScoreThresholdWithoutBG (SegTestHandle handle, int numOfClasses, int *scoreThreshold, bool writeOnModelFile=true)
 Set Segmentation's score threshold for each class. More...
 
eErrorType SR_GetSegTestMinPixelSizeThresholdWithoutBG (SegTestHandle handle, int *areaThreshold)
 Get Segmentation's area threshold for each class. More...
 
eErrorType SR_SetSegTestMinPixelSizeThresholdWithoutBG (SegTestHandle handle, int numOfClasses, int *areaThreshold, bool writeOnModelFile=true)
 Set Segmentation's area threshold for each class. More...
 
eErrorType SR_GetSegTestModeOfFilteringByPixelSize (SegTestHandle handle, eModeOfPixelSizeFilter *modeOfFiltering)
 Get the mode of filtering by Segmentation's area threshold. More...
 
eErrorType SR_SetSegTestModeOfFilteringByPixelSize (SegTestHandle handle, eModeOfPixelSizeFilter modeOfFiltering, bool writeOnModelFile=true)
 Set the mode of filtering by Segmentation's area threshold. More...
 
eErrorType SR_GetSegFilterObjByRegion (SegTestHandle handle, eFilterObjByRegionType *filterObjType)
 Get the filtering object type by Segmentation's filter object by region. More...
 
eErrorType SR_GetSegFilterObjSimpleParameters (SegTestHandle handle, float *simpleParams)
 Get the simple parameters of filtering object by Segmentation's filter object by region. More...
 
eErrorType SR_SetSegFilterObjByRegion (SegTestHandle handle, eFilterObjByRegionType filterObjType, bool writeOnModelFile=true)
 Set the filtering object type by Segmentation's filter object by region. More...
 
eErrorType SR_SetSegFilterObjSimpleParameters (SegTestHandle handle, float *simpleParams, bool writeOnModelFile=true)
 Set the simple parameters of filtering object by Segmentation's filter object by region. More...
 
eErrorType SR_SetSegTestMaxGPUMemorySizeInByte (SegTestHandle handle, unsigned long long maxGPUMemorySizeInByte)
 검사에 사용할 최대 gpu 메모리 사이즈를 byte단위로 설정합니다. More...
 
eErrorType SR_SetSegTestMaxInspectionSize (SegTestHandle handle, int maxInspectionHeight, int maxInspectionWidth, bool writeOnModelFile=true)
 Set Segmentation's max inspection size. More...
 
eErrorType SR_GetSegTestMaxInspectionSize (SegTestHandle handle, int *maxInspectionHeight, int *maxInspectionWidth)
 Get Segmentation's max inspection size. More...
 
eErrorType SR_GetSegTestForwardTimeLimit (SegTestHandle handle, float *forwardTimeLimit)
 Get the Forward time limit. More...
 
eErrorType SR_GetSegTestIsToUseForwardTimeLimit (SegTestHandle handle, bool *bIsToUseForwardTimeLimit)
 Get the boolean whether the current model is using time limit or not. More...
 
eErrorType SR_GetSegTestForwardTimeLimitVariables (SegTestHandle handle, float *forwardTimeLimit, bool *bIsToUseForwardTimeLimit)
 Get the Forward time limit variables. More...
 
eErrorType SR_SetSegTestForwardTimeLimit (SegTestHandle handle, float forwardTimeLimit, bool writeOnModelFile=true)
 Set the Forward time limit. More...
 
eErrorType SR_SetSegTestIsToUseForwardTimeLimit (SegTestHandle handle, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
 Set the boolean whether the current model is using time limit or not. More...
 
eErrorType SR_SetSegTestForwardTimeLimitVariables (SegTestHandle handle, float forwardTimeLimit, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
 Set the Forward time limit variables. More...
 
eErrorType SR_GetSegTestCropParamsUsedForExportingResults (SegTestHandle handle, int *cropHeight, int *cropWidth, eModeOfCropLargeObjects *mode, float *margin)
 Get cropping parameters (crop height & width, mode, margin) used for exporting segmented objects. More...
 
eErrorType SR_SetSegTestIsToStoreCroppedImage (SegTestHandle handle, bool isToStoreCroppedImage, int defaultCropSize, eModeOfCropLargeObjects modeOfCropLargeObjects=SR_CROP_BY_OBJECTSIZE_N_RESIZE_TO_CROPSIZE, float margin=0.05, bool writeOnModelFile=true)
 Set the parameters of Segmentation's crop object. More...
 
eErrorType SR_GetSegTestIsToStoreCroppedImage (SegTestHandle handle, bool *isToStoreCroppedImage, int *defaultCropSize, eModeOfCropLargeObjects *modeOfCropLargeObjects, float *margin)
 Get the parameters of Segmentation's crop object. More...
 
eErrorType SR_SetSegTestIsToCalcObjectScores (SegTestHandle handle, bool isToCalcObjectScores, bool writeOnModelFile=true)
 Set the boolean indicating whether calculate SR_SegmentedObject::scores or not. More...
 
eErrorType SR_GetSegTestIsToCalcObjectScores (SegTestHandle handle, bool *isToCalcObjectScores)
 Get the boolean indicating whether calculate SR_SegmentedObject::scores or not. More...
 
eErrorType SR_SetSegTestIsToCalcAverageColor (SegTestHandle handle, bool isToCalcAverageColors, bool writeOnModelFile=true)
 Set the boolean indicating whether calculate SR_SegmentedObject::averageColor or not. More...
 
eErrorType SR_GetSegTestIsToCalcAverageColor (SegTestHandle handle, bool *isToCalcAverageColors)
 Get the boolean indicating whether calculate SR_SegmentedObject::averageColor or not. More...
 
eErrorType SR_SetSegTestIsMatrixOutputIncluded (SegTestHandle handle, bool isMatrixOutputIncluded, bool writeOnModelFile=true)
 Set the boolean indicating whether include matrix output or not. More...
 
eErrorType SR_GetSegTestIsMatrixOutputIncluded (SegTestHandle handle, bool *isMatrixOutputIncluded)
 Get the boolean indicating whether include matrix output or not. More...
 
eErrorType SR_GetSegTestNumberOfPages (SegTestHandle handle, int *numberOfPages)
 Get the number of pages. More...
 
eErrorType SR_GetSegTestMaxStrLenOfPageName (SegTestHandle handle, int *len)
 Get a maximum length of page name. More...
 
eErrorType SR_GetSegTestOnePageNameWithWideChar (SegTestHandle handle, const int pageIdx, wchar_t *pageName)
 Get a wide char name of certain page by given index. More...
 
eErrorType SR_GetSegTestOnePageNameWithMultiByteChar (SegTestHandle handle, const int pageIdx, char *pageName)
 Get a multi byte char name of certain page by given index. More...
 
eErrorType SR_ApplySegTestFromImageFile (SegTestHandle handle, const char *imagePath, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to image by file path. More...
 
eErrorType SR_ApplySegTestFromImageFileByWideCharPath (SegTestHandle handle, const wchar_t *imagePath, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to image by file path. More...
 
eErrorType SR_ApplySegTestFrom8bitCharGrayArray (SegTestHandle handle, const unsigned char *imageData, const int height, const int width, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to 1-channel image by 8-bit data. More...
 
eErrorType SR_ApplySegTestFrom8bitCharColorArray (SegTestHandle handle, const unsigned char *imageData, const int height, const int width, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to 3-channels(BGR) image by 8-bit data. More...
 
eErrorType SR_ApplySegTestFromUnsignedIntColorArray (SegTestHandle handle, const unsigned int *imageData, const int height, const int width, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to 4-channels(BGRA) image by 8-bit data. More...
 
eErrorType SR_ApplySegTestFrom16bitCharGrayArray (SegTestHandle handle, const unsigned char *imageData, const int height, const int width, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to 1-channel image by 16-bit data. More...
 
eErrorType SR_ApplySegTestFrom16bitCharColorArray (SegTestHandle handle, const unsigned char *imageData, const int height, const int width, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to 3-channels(BGR) image by 16-bit data. More...
 
eErrorType SR_ApplySegTestFrom16bitUnsignedIntColorArray (SegTestHandle handle, const unsigned int *imageData, const int height, const int width, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to 4-channels(BGRA) image by 16-bit data. More...
 
eErrorType SR_ApplySegTestFromMultiple8bitCharGrayArrays (SegTestHandle handle, int numberOfImages, unsigned char **imageData, int *heights, int *widths, SegTestResult *segTestResults, int flag)
 Apply segmentation algorithm to 1-channel images by 8-bit data (batch-inspection). More...
 
eErrorType SR_ApplySegTestFromMultiple8bitCharColorArrays (SegTestHandle handle, int numberOfImages, unsigned char **imageData, int *heights, int *widths, SegTestResult *segTestResults, int flag)
 Apply segmentation algorithm to 3-channels(BGR) images by 8-bit data (batch-inspection). More...
 
eErrorType SR_ApplySegTestFromMultipleUnsignedIntColorArrays (SegTestHandle handle, int numberOfImages, unsigned int **imageData, int *heights, int *widths, SegTestResult *segTestResults, int flag)
 Apply segmentation algorithm to 4-channels(BGRA) images by 8-bit data (batch-inspection). More...
 
eErrorType SR_ApplySegTestFromMultiPage8bitCharArrays (SegTestHandle handle, int numOfPages, unsigned char **imageData, int height, int width, int *channels, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to multi-page image by 8-bit data (multi-page). More...
 
eErrorType SR_ApplySegTestFromMultiPageImageFileByWideCharPath (SegTestHandle handle, int numOfPages, const wchar_t **imagePaths, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to multi-page image by file path (multi-page). More...
 
eErrorType SR_ApplySegTestFromMultiPageImageFileByMultiByteCharPath (SegTestHandle handle, int numOfPages, const char **imagePaths, SegTestResult segTestResult, int flag)
 Apply segmentation algorithm to multi-page image by file path (multi-page). More...
 
eErrorType SR_ApplySegTestFromDetectedBoxes (SegTestHandle handle, int numberOfBoxes, SR_DetectedBox *detectedBoxes, SegTestResult *segTestResults, int flag)
 Apply segmentation algorithm to SR_DetectedBox::croppedImage. More...
 
eErrorType SR_ApplySegTestForCompressedBinaryOutput (SegTestHandle handle, const void *imageData, const int height, const int width, const int channels, const unsigned int binarySizeInBytes, void *binaryOut)
 Apply segmentation algorithm to image and get compressed binary cv8u output. More...
 
eErrorType SR_GetSegTestOutputMatrixSizeInfo (SegTestResult segTestResult, int *scoreMatrixChannel, int *scoreMatrixSize)
 Get the size of Score matrix. More...
 
eErrorType SR_GetSegTestOutputMatrix (SegTestResult segTestResult, int scoreMatrixSize, unsigned char *scoreMatrixData)
 Get Score matrix. More...
 
eErrorType SR_GetSegTestROI (SegTestResult segTestResult, int *xROI, int *yROI, int *wROI, int *hROI)
 Get ROI. More...
 
eErrorType SR_GetSegTestNumberOfSegmentedObjects (SegTestResult segTestResult, int *numberOfSegmentedObjects)
 Get the number of SR_SegmentedObject. More...
 
eErrorType SR_GetSegTestSegmentedObjects (SegTestResult segTestResult, SR_SegmentedObject *segmentedObjects)
 Get SR_SegmentedObject s. More...
 
eErrorType SR_GetSegTestNumberOfDeletedObjects (SegTestResult segTestResult, int *numberOfDeletedObjects)
 Get the number of deleted SR_SegmentedObject s by filter process Segmentation's area threshold. More...
 
eErrorType SR_GetSegTestDeletedObjects (SegTestResult segTestResult, SR_SegmentedObject *deletedObjects)
 Get deleted SR_SegmentedObject s by filter process Segmentation's area threshold. More...
 
eErrorType SR_GetSegTestResultOriginalImageSize (SegTestResult segTestResult, int *width, int *height)
 Get the size of inspected image. More...
 
eErrorType SR_GetSegTestInspectionTime (SegTestResult segTestResult, long *inspectionTimeInLong)
 Get the inspection time. More...
 
eErrorType SR_GetSegTestInspectionTimeInDouble (SegTestResult segTestResult, double *inspectionTimeInDouble)
 Get the inspection time. More...
 
eErrorType SR_GetSegTestLoadImageTime (SegTestResult segTestResult, long *imageLoadingTimeInLong)
 Get the image loading time. More...
 
eErrorType SR_GetSegTestLoadImageTimeInDouble (SegTestResult segTestResult, double *imageLoadingTimeInDouble)
 Get the image loading time. More...
 
eErrorType SR_GetSegTestIsExceededMaxInspectionSize (SegTestResult segTestResult, bool *isExceededMaxInspectionSize)
 Get whether the size of inspected image exceeds max inspection size. More...
 
eErrorType SR_GetSegTestIsImageCropped (SegTestResult segTestResult, bool *isImageCropped)
 Get whether the image is cropped due to lack of GPU memory. More...
 
eErrorType SR_DestroySegTestHandle (SegTestHandle handle)
 Destruct a SegTestHandle.
 
eErrorType SR_DeleteSegTestResult (SegTestResult segTestResult)
 Destruct a SegTestResult.
 
eErrorType SR_SetSegTestOptionsAsDefault (SegTestHandle handle)
 Reset inspection options(Forward time limit, Segmentation's score threshold etc) as default values. More...
 
eErrorType SR_WriteSegTestOptionsOnModelFile (SegTestHandle handle)
 Write inspection options(Forward time limit, Segmentation's score threshold etc) on the model file.
 

Detailed Description

Header file for segmentation module.

Enumeration Type Documentation

◆ eSegTestOutputType

Segmentation output type.

ONE_CLASS: 해당 픽셀이 정상인지 결함인지만을 판단합니다. score matrix 의 크기는 height x width 입니다.
MULTI_CLASS: 해당 픽셀이 정상인지 결함인지, 어떤 종류의 결함인지를 판단합니다. score matrix의 크기는 (# of classes) x height x width 입니다.
MATRIX_OUTPUT: 픽셀단위의 score matrix만을 계산합니다. 이어져 있는 픽셀끼리 뭉쳐진 object 단위(SR_SegmentedObject)는 계산하지 않습니다.
CV_CONTOUR_OUTPUT: 픽셀단위의 score matrix와 obejct 단위의 (SR_SegmentedObject)를 계산합니다.
HEATMAP_OUTPUT: score threshold 가 가해지지 않은 heat map(raw score matrix)를 계산합니다.

Enumerator
SR_ONE_CLASS_MATRIX_OUTPUT 

ONE_CLASS + MATRIX_OUTPUT.

SR_MULTI_CLASS_MATRIX_OUTPUT 

MULTI_CLASS + MATRIX_OUTPUT.

SR_ONE_CLASS_CV_CONTOUR_OUTPUT 

ONE_CLASS + CV_CONTOUR_OUTPUT.

SR_MULTI_CLASS_CV_CONTOUR_OUTPUT 

MULTI_CLASS + CV_CONTOUR_OUTPUT.
Default setting. Users can get the same result as SaigeVision training program.

Function Documentation

◆ SR_GetSegTestCropParamsUsedForExportingResults()

eErrorType SR_GetSegTestCropParamsUsedForExportingResults ( SegTestHandle  handle,
int *  cropHeight,
int *  cropWidth,
eModeOfCropLargeObjects *  mode,
float *  margin 
)

Get cropping parameters (crop height & width, mode, margin) used for exporting segmented objects.

If user have never exported segmented objects, crop height & width is the same with 'Crop size' used for training.
Is is recommended to use SR_GetSegTestIsToStoreCroppedImage instead.

◆ SR_SetSegTestMaxGPUMemorySizeInByte()

eErrorType SR_SetSegTestMaxGPUMemorySizeInByte ( SegTestHandle  handle,
unsigned long long  maxGPUMemorySizeInByte 
)

검사에 사용할 최대 gpu 메모리 사이즈를 byte단위로 설정합니다.

Parameters
handlesegmentation file handler
maxGPUMemorySizeInBytemaximum GPU memory size in bytes to use for this handler
Warning
Must be called before SR_LoadSegTestNetworkInGPU.

◆ SR_SetSegTestOptionsAsDefault()

eErrorType SR_SetSegTestOptionsAsDefault ( SegTestHandle  handle)

Reset inspection options(Forward time limit, Segmentation's score threshold etc) as default values.