SaigeVision C/C++  1.4.7
SaigeVision API document for C/C++
DetectorTestDLL.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #ifdef __linux__
7  #define DLLTYPE_DETECTION
8 #elif _WIN32
9  #ifdef DLLEXPORT_DETECTION
10  #define DLLTYPE_DETECTION extern "C" __declspec(dllexport)
11  #else
12  #define DLLTYPE_DETECTION extern "C" __declspec(dllimport)
13  #endif
14 #endif
15 
16 #include "CommonHeaderDLL.h"
17 
52 typedef void* DetTestHandle;
67 typedef void* DetTestResult;
68 
75 DLLTYPE_DETECTION DetTestHandle SR_CreateDetTestHandle(const char* filePath);
76 
83 DLLTYPE_DETECTION DetTestHandle SR_CreateDetTestHandleByWideCharPath(const wchar_t* filePath);
84 
88 DLLTYPE_DETECTION DetTestResult SR_MakeDetTestResult();
98  int GPUNumber);
99 
102  eAlgorithmType* algoType);
103 
106 
142  int* numberOfClasses);
143 
149  int* len);
150 
157  const int classIdx,
158  wchar_t* className);
159 
166  const int classIdx,
167  char* className);
168 
175  const int classIdx,
176  int* classColor);
199  int* maxNumBoxes);
200 
208  int numOfClasses,
209  int* maxNumBoxes,
210  bool writeOnModelFile = true);
234  const int classIdx,
235  int* scoreThreshold);
236 
243  int* scoreThreshold);
244 
253  int numOfClasses,
254  int* scoreThreshold,
255  bool writeOnModelFile = true);
275  int* areaThreshold);
276 
284  int* areaThreshold,
285  bool writeOnModelFile = true);
296  int* numHorizontalCroppedPatches,
297  int* numVerticalCroppedPatches);
298 
340  bool isToStoreCroppedImage,
341  int defaultCropSize = -1,
343  float margin = 0.00,
344  bool writeOnModelFile = true);
345 
359  float* forwardTimeLimit); /* milliseconds */
360 
367  bool* bIsToUseForwardTimeLimit);
368 
378  float* forwardTimeLimit, /* milliseconds */
379  bool* bIsToUseForwardTimeLimit);
380 
388  float forwardTimeLimit, /* milliseconds */
389  bool writeOnModelFile = true);
390 
398  bool bIsToUseForwardTimeLimit,
399  bool writeOnModelFile = true);
400 
411  float forwardTimeLimit, /* milliseconds */
412  bool bIsToUseForwardTimeLimit,
413  bool writeOnModelFile = true);
440  const char* imagePath,
441  DetTestResult detTestResult);
442 
449  const wchar_t* imagePath,
450  DetTestResult detTestResult);
451 
460  const unsigned char* imageData,
461  const int height,
462  const int width,
463  DetTestResult detTestResult);
464 
473  const unsigned char* imageData,
474  const int height,
475  const int width,
476  DetTestResult detTestResult);
477 
486  const unsigned int* imageData,
487  const int height,
488  const int width,
489  DetTestResult detTestResult);
539  int* numDetectedBoxes);
540 
547  const int numDetectedBoxes,
548  SR_DetectedBox* detectedBoxes);
549 
550 
561  const int numDetectedBoxes,
562  int* classIndices,
563  float* scores,
564  int* coordinatesXYXY);
565 
575 DLLTYPE_DETECTION eErrorType SR_GetDetTestResultOneBoxInfo(DetTestResult detTestResult,
576  const int boxIndex,
577  int* classIndex,
578  float* score,
579  int* coordinateXYXY);
580 
587  int numClasses,
588  int* numRawBoxes);
589 
594 DLLTYPE_DETECTION eErrorType SR_GetDetTestInspectionTime(DetTestResult detTestResult,
595  long* inspectionTimeInLong); /* milliseconds */
601  double* inspectionTimeInDouble); /* milliseconds */
602 
607 DLLTYPE_DETECTION eErrorType SR_GetDetTestLoadImageTime(DetTestResult detTestResult,
608  long* imageLoadingTimeInLong); /* milliseconds */
614  double* imageLoadingTimeInDouble); /* milliseconds */
626 
628 DLLTYPE_DETECTION eErrorType SR_DeleteDetTestResult(DetTestResult detTestResult);
640 
643 
644 
645 #ifdef SR_USE_DEPRECATED_FUNCTIONS
646 /***********************************************************
647 * These functions will be deprecated in version 2.0.0
648 ***********************************************************/
649 /* This function behaves identically with SR_GetDetTestOneClassNameWithMultiByteChar*/
650 DLLTYPE_DETECTION eErrorType SR_GetDetTestOneClassNameWith1byteCharacter(DetTestHandle handle, const int index, char* className);
651 
652 /* This function behaves identically with SR_GetDetTestOneClassNameWithWideChar*/
653 DLLTYPE_DETECTION eErrorType SR_GetDetTestOneClassName(DetTestHandle handle, const int index, wchar_t* className);
654 
655 /* This function behaves identically with SR_GetDetTestMinScoreThresholdForSingleClass*/
656 DLLTYPE_DETECTION eErrorType SR_GetDetTestOneThresholdScore(DetTestHandle handle, const int index, int* scoreThreshold);
657 
658 /* This function behaves identically with SR_GetDetTestMinScoreThreshold*/
659 DLLTYPE_DETECTION eErrorType SR_GetDetTestThresholdScore(DetTestHandle handle, int* scoreThreshold);
660 
661 /* This function behaves identically with SR_SetDetTestMinScoreThreshold*/
662 DLLTYPE_DETECTION eErrorType SR_SetDetTestThresholdScore(DetTestHandle handle, int numberOfClasses, int* scoreThreshold);
663 #endif
SR_GetDetTestMinScoreThreshold
eErrorType SR_GetDetTestMinScoreThreshold(DetTestHandle handle, int *scoreThreshold)
Get Detection's score threshold for each class.
SR_GetDetTestOneClassNameWithWideChar
eErrorType SR_GetDetTestOneClassNameWithWideChar(DetTestHandle handle, const int classIdx, wchar_t *className)
Get a wide char name of certain class by given index.
SR_CreateDetTestHandleByWideCharPath
DetTestHandle SR_CreateDetTestHandleByWideCharPath(const wchar_t *filePath)
Create a DetTestHandle via wide char path.
SR_ApplyDetTestFromImageFileByWideCharPath
eErrorType SR_ApplyDetTestFromImageFileByWideCharPath(DetTestHandle handle, const wchar_t *imagePath, DetTestResult detTestResult)
Apply detection algorithm to image by file path.
eAlgorithmType
eAlgorithmType
Enumerator indicating a type of model.
Definition: CommonHeaderDLL.h:49
SR_GetDetTestOneClassNameWithMultiByteChar
eErrorType SR_GetDetTestOneClassNameWithMultiByteChar(DetTestHandle handle, const int classIdx, char *className)
Get a multi byte char name of certain class by given index.
SR_GetDetTestMaxStrLenOfClassName
eErrorType SR_GetDetTestMaxStrLenOfClassName(DetTestHandle handle, int *len)
Get a maximum length of class name.
eModeOfCropLargeObjects
eModeOfCropLargeObjects
Enumerator indicating a mode of cropping large objects in segmentation.
Definition: CommonHeaderDLL.h:99
SR_ApplyDetTestFromImageFile
eErrorType SR_ApplyDetTestFromImageFile(DetTestHandle handle, const char *imagePath, DetTestResult detTestResult)
Apply detection algorithm to image by file path.
SR_SetDetTestOptionsAsDefault
eErrorType SR_SetDetTestOptionsAsDefault(DetTestHandle handle)
Reset inspection options(Forward time limit, Detection's score threshold etc) as default values.
SR_GetDetTestIsToUseForwardTimeLimit
eErrorType SR_GetDetTestIsToUseForwardTimeLimit(DetTestHandle handle, bool *bIsToUseForwardTimeLimit)
Get the boolean whether the current model is using time limit or not.
SR_GetDetTestPixelSizeThreshold
eErrorType SR_GetDetTestPixelSizeThreshold(DetTestHandle handle, int *areaThreshold)
Get Detection's area threshold for each class.
SR_SetDetTestMinScoreThreshold
eErrorType SR_SetDetTestMinScoreThreshold(DetTestHandle handle, int numOfClasses, int *scoreThreshold, bool writeOnModelFile=true)
Set Detection's score threshold for each class.
SR_GetDetTestForwardTimeLimitVariables
eErrorType SR_GetDetTestForwardTimeLimitVariables(DetTestHandle handle, float *forwardTimeLimit, bool *bIsToUseForwardTimeLimit)
Get the Forward time limit variables.
SR_GetDetTestNumberOfClasses
eErrorType SR_GetDetTestNumberOfClasses(DetTestHandle handle, int *numberOfClasses)
Get the number of classes.
SR_SetDetTestIsToUseForwardTimeLimit
eErrorType SR_SetDetTestIsToUseForwardTimeLimit(DetTestHandle handle, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
Set the boolean whether the current model is using time limit or not.
SR_GetDetTestForwardTimeLimit
eErrorType SR_GetDetTestForwardTimeLimit(DetTestHandle handle, float *forwardTimeLimit)
Get the Forward time limit.
SR_SetDetTestMaxNumberOfDetectionBoxesForEachClass
eErrorType SR_SetDetTestMaxNumberOfDetectionBoxesForEachClass(DetTestHandle handle, int numOfClasses, int *maxNumBoxes, bool writeOnModelFile=true)
Set Max number of boxes.
SR_GetDetTestResultNumberOfBoxes
eErrorType SR_GetDetTestResultNumberOfBoxes(DetTestResult detTestResult, int *numDetectedBoxes)
Get the number of detected boxes.
SR_GetDetTestResultDetectedBoxes
eErrorType SR_GetDetTestResultDetectedBoxes(DetTestResult detTestResult, const int numDetectedBoxes, SR_DetectedBox *detectedBoxes)
Get SR_DetectedBox.
SR_LoadDetTestNetworkInGPU
eErrorType SR_LoadDetTestNetworkInGPU(DetTestHandle handle, int GPUNumber)
Allocate required cpu & gpu memory.
SR_DestroyDetTestHandle
eErrorType SR_DestroyDetTestHandle(DetTestHandle handle)
Destruct a DetTestHandle.
SR_GetDetTestLoadImageTimeInDouble
eErrorType SR_GetDetTestLoadImageTimeInDouble(DetTestResult detTestResult, double *imageLoadingTimeInDouble)
Get the image loading time.
SR_GetDetTestResultOneBoxInfo
eErrorType SR_GetDetTestResultOneBoxInfo(DetTestResult detTestResult, const int boxIndex, int *classIndex, float *score, int *coordinateXYXY)
Get a single detected box.
SR_DeleteDetTestResult
eErrorType SR_DeleteDetTestResult(DetTestResult detTestResult)
Destruct a DetTestResult.
SR_ApplyDetTestFrom8bitCharGrayArray
eErrorType SR_ApplyDetTestFrom8bitCharGrayArray(DetTestHandle handle, const unsigned char *imageData, const int height, const int width, DetTestResult detTestResult)
Apply detection algorithm to 1-channel image by 8-bit data.
SR_GetDetTestInspectionTime
eErrorType SR_GetDetTestInspectionTime(DetTestResult detTestResult, long *inspectionTimeInLong)
Get the inspection time.
SR_SetDetTestForwardTimeLimit
eErrorType SR_SetDetTestForwardTimeLimit(DetTestHandle handle, float forwardTimeLimit, bool writeOnModelFile=true)
Set the Forward time limit.
SR_GetDetTestOneClassColor
eErrorType SR_GetDetTestOneClassColor(DetTestHandle handle, const int classIdx, int *classColor)
Get a color of certain class by given index.
SR_GetDetTestResultNumberOfBoxesBeforeFiltered
eErrorType SR_GetDetTestResultNumberOfBoxesBeforeFiltered(DetTestResult detTestResult, int numClasses, int *numRawBoxes)
Get the number of raw detected boxes before filtered by Max number of boxes for each class.
SR_ApplyDetTestFrom8bitCharColorArray
eErrorType SR_ApplyDetTestFrom8bitCharColorArray(DetTestHandle handle, const unsigned char *imageData, const int height, const int width, DetTestResult detTestResult)
Apply detection algorithm to 3-channels(BGR) image by 8-bit data.
SR_SetDetTestForwardTimeLimitVariables
eErrorType SR_SetDetTestForwardTimeLimitVariables(DetTestHandle handle, float forwardTimeLimit, bool bIsToUseForwardTimeLimit, bool writeOnModelFile=true)
Set the Forward time limit variables.
SR_GetDetTestCropSize
eErrorType SR_GetDetTestCropSize(DetTestHandle handle, int *numHorizontalCroppedPatches, int *numVerticalCroppedPatches)
Get the number of horizontally and vertically cropped patches.
SR_GetDetTestAlgorithmType
eErrorType SR_GetDetTestAlgorithmType(DetTestHandle handle, eAlgorithmType *algoType)
Get a algorithm type(ex, standard, deep) of a detection model.
SR_SetDetTestPixelSizeThreshold
eErrorType SR_SetDetTestPixelSizeThreshold(DetTestHandle handle, int *areaThreshold, bool writeOnModelFile=true)
Set Detection's area threshold for each class.
SR_DetectedBox
Struct describing features of a detected box.
Definition: CommonHeaderDLL.h:213
SR_CROP_BY_OBJECTSIZE_NOT_SQUARE
@ SR_CROP_BY_OBJECTSIZE_NOT_SQUARE
Definition: CommonHeaderDLL.h:103
CommonHeaderDLL.h
Header file for Commonly used variables.
DetTestHandle
void * DetTestHandle
Detection file handler.
Definition: DetectorTestDLL.h:52
SR_GetDetTestInspectionTimeInDouble
eErrorType SR_GetDetTestInspectionTimeInDouble(DetTestResult detTestResult, double *inspectionTimeInDouble)
Get the inspection time.
eErrorType
eErrorType
Enumerator indicating error codes.
Definition: CommonHeaderDLL.h:25
SR_PrintDetTestParameters
eErrorType SR_PrintDetTestParameters(DetTestHandle handle)
Print a model parameters (Detection's class information, inspection options...)
SR_GetDetTestMinScoreThresholdForSingleClass
eErrorType SR_GetDetTestMinScoreThresholdForSingleClass(DetTestHandle handle, const int classIdx, int *scoreThreshold)
Get Detection's score threshold for single class.
SR_CreateDetTestHandle
DetTestHandle SR_CreateDetTestHandle(const char *filePath)
Create a DetTestHandle via multi byte char path.
SR_GetDetTestMaxNumberOfDetectionBoxesForEachClass
eErrorType SR_GetDetTestMaxNumberOfDetectionBoxesForEachClass(DetTestHandle handle, int *maxNumBoxes)
Get Max number of boxes.
SR_WriteDetTestOptionsOnModelFile
eErrorType SR_WriteDetTestOptionsOnModelFile(DetTestHandle handle)
Write inspection options(Forward time limit, Detection's score threshold etc) on model file.
SR_ApplyDetTestFromUnsignedIntColorArray
eErrorType SR_ApplyDetTestFromUnsignedIntColorArray(DetTestHandle handle, const unsigned int *imageData, const int height, const int width, DetTestResult detTestResult)
Apply detection algorithm to 4-channels(BGRA) image by 8-bit data.
SR_SetDetTestCropDetectedBoxesOptions
eErrorType SR_SetDetTestCropDetectedBoxesOptions(DetTestHandle handle, bool isToStoreCroppedImage, int defaultCropSize=-1, eModeOfCropLargeObjects modeOfCropLargeObjects=SR_CROP_BY_OBJECTSIZE_NOT_SQUARE, float margin=0.00, bool writeOnModelFile=true)
Set the parameters of Detection's crop box.
SR_GetDetTestLoadImageTime
eErrorType SR_GetDetTestLoadImageTime(DetTestResult detTestResult, long *imageLoadingTimeInLong)
Get the image loading time.
SR_GetDetTestResultAllBoxesInfo
eErrorType SR_GetDetTestResultAllBoxesInfo(DetTestResult detTestResult, const int numDetectedBoxes, int *classIndices, float *scores, int *coordinatesXYXY)
Get all the detected boxes.
SR_MakeDetTestResult
DetTestResult SR_MakeDetTestResult()
Construct a DetTestResult.
DetTestResult
void * DetTestResult
Detection inspection results handler.
Definition: DetectorTestDLL.h:67