OpenCV for Unity  2.6.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.9.0/index.html ) for the details of the argument of the method.
Static Public Member Functions | Public Attributes | List of all members
OpenCVForUnity.DnnModule.Dnn Class Reference

Static Public Member Functions

static List< int > getAvailableTargets (int be)
 
static Net readNetFromDarknet (string cfgFile, string darknetModel)
 Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files. More...
 
static Net readNetFromDarknet (string cfgFile)
 Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files. More...
 
static Net readNetFromDarknet (MatOfByte bufferCfg, MatOfByte bufferModel)
 Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files. More...
 
static Net readNetFromDarknet (MatOfByte bufferCfg)
 Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files. More...
 
static Net readNetFromCaffe (string prototxt, string caffeModel)
 Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format. More...
 
static Net readNetFromCaffe (string prototxt)
 Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format. More...
 
static Net readNetFromCaffe (MatOfByte bufferProto, MatOfByte bufferModel)
 Reads a network model stored in Caffe model in memory. More...
 
static Net readNetFromCaffe (MatOfByte bufferProto)
 Reads a network model stored in Caffe model in memory. More...
 
static Net readNetFromTensorflow (string model, string config)
 Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format. More...
 
static Net readNetFromTensorflow (string model)
 Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format. More...
 
static Net readNetFromTensorflow (MatOfByte bufferModel, MatOfByte bufferConfig)
 Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format. More...
 
static Net readNetFromTensorflow (MatOfByte bufferModel)
 Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format. More...
 
static Net readNetFromTFLite (string model)
 Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format. More...
 
static Net readNetFromTFLite (MatOfByte bufferModel)
 Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format. More...
 
static Net readNetFromTorch (string model, bool isBinary, bool evaluate)
 Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format. More...
 
static Net readNetFromTorch (string model, bool isBinary)
 Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format. More...
 
static Net readNetFromTorch (string model)
 Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format. More...
 
static Net readNet (string model, string config, string framework)
 Read deep learning network represented in one of the supported formats. More...
 
static Net readNet (string model, string config)
 Read deep learning network represented in one of the supported formats. More...
 
static Net readNet (string model)
 Read deep learning network represented in one of the supported formats. More...
 
static Net readNet (string framework, MatOfByte bufferModel, MatOfByte bufferConfig)
 Read deep learning network represented in one of the supported formats. More...
 
static Net readNet (string framework, MatOfByte bufferModel)
 Read deep learning network represented in one of the supported formats. More...
 
static Mat readTorchBlob (string filename, bool isBinary)
 Loads blob which was serialized as torch.Tensor object of Torch7 framework. More...
 
static Mat readTorchBlob (string filename)
 Loads blob which was serialized as torch.Tensor object of Torch7 framework. More...
 
static Net readNetFromModelOptimizer (string xml, string bin)
 Load a network from Intel's Model Optimizer intermediate representation. More...
 
static Net readNetFromModelOptimizer (string xml)
 Load a network from Intel's Model Optimizer intermediate representation. More...
 
static Net readNetFromModelOptimizer (MatOfByte bufferModelConfig, MatOfByte bufferWeights)
 Load a network from Intel's Model Optimizer intermediate representation. More...
 
static Net readNetFromONNX (string onnxFile)
 Reads a network model <a href="https://onnx.ai/">ONNX</a>. More...
 
static Net readNetFromONNX (MatOfByte buffer)
 Reads a network model from <a href="https://onnx.ai/">ONNX</a> in-memory buffer. More...
 
static Mat readTensorFromONNX (string path)
 Creates blob from .pb file. More...
 
static Mat blobFromImage (Mat image, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop, int ddepth)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImage (Mat image, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImage (Mat image, double scalefactor, Size size, Scalar mean, bool swapRB)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImage (Mat image, double scalefactor, Size size, Scalar mean)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImage (Mat image, double scalefactor, Size size)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImage (Mat image, double scalefactor)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImage (Mat image)
 Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImages (List< Mat > images, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop, int ddepth)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImages (List< Mat > images, double scalefactor, Size size, Scalar mean, bool swapRB, bool crop)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImages (List< Mat > images, double scalefactor, Size size, Scalar mean, bool swapRB)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImages (List< Mat > images, double scalefactor, Size size, Scalar mean)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImages (List< Mat > images, double scalefactor, Size size)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImages (List< Mat > images, double scalefactor)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImages (List< Mat > images)
 Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels. More...
 
static Mat blobFromImageWithParams (Mat image, Image2BlobParams param)
 Creates 4-dimensional blob from image with given params. More...
 
static Mat blobFromImageWithParams (Mat image)
 Creates 4-dimensional blob from image with given params. More...
 
static void blobFromImageWithParams (Mat image, Mat blob, Image2BlobParams param)
 
static void blobFromImageWithParams (Mat image, Mat blob)
 
static Mat blobFromImagesWithParams (List< Mat > images, Image2BlobParams param)
 Creates 4-dimensional blob from series of images with given params. More...
 
static Mat blobFromImagesWithParams (List< Mat > images)
 Creates 4-dimensional blob from series of images with given params. More...
 
static void blobFromImagesWithParams (List< Mat > images, Mat blob, Image2BlobParams param)
 
static void blobFromImagesWithParams (List< Mat > images, Mat blob)
 
static void imagesFromBlob (Mat blob_, List< Mat > images_)
 Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>). More...
 
static void shrinkCaffeModel (string src, string dst, List< string > layersTypes)
 Convert all weights of Caffe network to half precision floating point. More...
 
static void shrinkCaffeModel (string src, string dst)
 Convert all weights of Caffe network to half precision floating point. More...
 
static void writeTextGraph (string model, string output)
 Create a text representation for a binary network stored in protocol buffer format. More...
 
static void NMSBoxes (MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k)
 Performs non maximum suppression given boxes and corresponding scores. More...
 
static void NMSBoxes (MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta)
 Performs non maximum suppression given boxes and corresponding scores. More...
 
static void NMSBoxes (MatOfRect2d bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices)
 Performs non maximum suppression given boxes and corresponding scores. More...
 
static void NMSBoxesRotated (MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k)
 
static void NMSBoxesRotated (MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices, float eta)
 
static void NMSBoxesRotated (MatOfRotatedRect bboxes, MatOfFloat scores, float score_threshold, float nms_threshold, MatOfInt indices)
 
static void NMSBoxesBatched (MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices, float eta, int top_k)
 Performs batched non maximum suppression on given boxes and corresponding scores across different classes. More...
 
static void NMSBoxesBatched (MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices, float eta)
 Performs batched non maximum suppression on given boxes and corresponding scores across different classes. More...
 
static void NMSBoxesBatched (MatOfRect2d bboxes, MatOfFloat scores, MatOfInt class_ids, float score_threshold, float nms_threshold, MatOfInt indices)
 Performs batched non maximum suppression on given boxes and corresponding scores across different classes. More...
 
static void softNMSBoxes (MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices, long top_k, float sigma)
 Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503. More...
 
static void softNMSBoxes (MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices, long top_k)
 Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503. More...
 
static void softNMSBoxes (MatOfRect bboxes, MatOfFloat scores, MatOfFloat updated_scores, float score_threshold, float nms_threshold, MatOfInt indices)
 Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503. More...
 
static string getInferenceEngineBackendType ()
 Returns Inference Engine internal backend API. More...
 
static string setInferenceEngineBackendType (string newBackendType)
 Specify Inference Engine internal backend API. More...
 
static void resetMyriadDevice ()
 Release a Myriad device (binded by OpenCV). More...
 
static string getInferenceEngineVPUType ()
 Returns Inference Engine VPU type. More...
 
static string getInferenceEngineCPUType ()
 Returns Inference Engine CPU type. More...
 
static void releaseHDDLPlugin ()
 Release a HDDL plugin. More...
 

Public Attributes

const int DNN_BACKEND_DEFAULT = 0
 
const int DNN_BACKEND_HALIDE = 0 + 1
 
const int DNN_BACKEND_INFERENCE_ENGINE = 0 + 2
 
const int DNN_BACKEND_OPENCV = 0 + 3
 
const int DNN_BACKEND_VKCOM = 0 + 4
 
const int DNN_BACKEND_CUDA = 0 + 5
 
const int DNN_BACKEND_WEBNN = 0 + 6
 
const int DNN_BACKEND_TIMVX = 0 + 7
 
const int DNN_BACKEND_CANN = 0 + 8
 
const int DNN_LAYOUT_UNKNOWN = 0
 
const int DNN_LAYOUT_ND = 1
 
const int DNN_LAYOUT_NCHW = 2
 
const int DNN_LAYOUT_NCDHW = 3
 
const int DNN_LAYOUT_NHWC = 4
 
const int DNN_LAYOUT_NDHWC = 5
 
const int DNN_LAYOUT_PLANAR = 6
 
const int DNN_PMODE_NULL = 0
 
const int DNN_PMODE_CROP_CENTER = 1
 
const int DNN_PMODE_LETTERBOX = 2
 
const int SoftNMSMethod_SOFTNMS_LINEAR = 1
 
const int SoftNMSMethod_SOFTNMS_GAUSSIAN = 2
 
const int DNN_TARGET_CPU = 0
 
const int DNN_TARGET_OPENCL = 0 + 1
 
const int DNN_TARGET_OPENCL_FP16 = 0 + 2
 
const int DNN_TARGET_MYRIAD = 0 + 3
 
const int DNN_TARGET_VULKAN = 0 + 4
 
const int DNN_TARGET_FPGA = 0 + 5
 
const int DNN_TARGET_CUDA = 0 + 6
 
const int DNN_TARGET_CUDA_FP16 = 0 + 7
 
const int DNN_TARGET_HDDL = 0 + 8
 
const int DNN_TARGET_NPU = 0 + 9
 
const int DNN_TARGET_CPU_FP16 = 0 + 10
 

Member Function Documentation

◆ blobFromImage() [1/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImage ( Mat  image,
double  scalefactor,
Size  size,
Scalar  mean,
bool  swapRB,
bool  crop,
int  ddepth 
)
static

Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imageinput image (with 1-, 3- or 4-channels).
scalefactormultiplier for images values.
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImage() [2/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImage ( Mat  image,
double  scalefactor,
Size  size,
Scalar  mean,
bool  swapRB,
bool  crop 
)
static

Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imageinput image (with 1-, 3- or 4-channels).
scalefactormultiplier for images values.
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImage() [3/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImage ( Mat  image,
double  scalefactor,
Size  size,
Scalar  mean,
bool  swapRB 
)
static

Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imageinput image (with 1-, 3- or 4-channels).
scalefactormultiplier for images values.
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImage() [4/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImage ( Mat  image,
double  scalefactor,
Size  size,
Scalar  mean 
)
static

Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imageinput image (with 1-, 3- or 4-channels).
scalefactormultiplier for images values.
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImage() [5/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImage ( Mat  image,
double  scalefactor,
Size  size 
)
static

Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imageinput image (with 1-, 3- or 4-channels).
scalefactormultiplier for images values.
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImage() [6/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImage ( Mat  image,
double  scalefactor 
)
static

Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imageinput image (with 1-, 3- or 4-channels).
scalefactormultiplier for images values.
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImage() [7/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImage ( Mat  image)
static

Creates 4-dimensional blob from image. Optionally resizes and crops image from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imageinput image (with 1-, 3- or 4-channels).
scalefactormultiplier for images values.
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImages() [1/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImages ( List< Mat images,
double  scalefactor,
Size  size,
Scalar  mean,
bool  swapRB,
bool  crop,
int  ddepth 
)
static

Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imagesinput images (all with 1-, 3- or 4-channels).
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
scalefactormultiplier for images values.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImages() [2/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImages ( List< Mat images,
double  scalefactor,
Size  size,
Scalar  mean,
bool  swapRB,
bool  crop 
)
static

Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imagesinput images (all with 1-, 3- or 4-channels).
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
scalefactormultiplier for images values.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImages() [3/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImages ( List< Mat images,
double  scalefactor,
Size  size,
Scalar  mean,
bool  swapRB 
)
static

Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imagesinput images (all with 1-, 3- or 4-channels).
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
scalefactormultiplier for images values.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImages() [4/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImages ( List< Mat images,
double  scalefactor,
Size  size,
Scalar  mean 
)
static

Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imagesinput images (all with 1-, 3- or 4-channels).
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
scalefactormultiplier for images values.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImages() [5/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImages ( List< Mat images,
double  scalefactor,
Size  size 
)
static

Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imagesinput images (all with 1-, 3- or 4-channels).
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
scalefactormultiplier for images values.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImages() [6/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImages ( List< Mat images,
double  scalefactor 
)
static

Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imagesinput images (all with 1-, 3- or 4-channels).
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
scalefactormultiplier for images values.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImages() [7/7]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImages ( List< Mat images)
static

Creates 4-dimensional blob from series of images. Optionally resizes and crops images from center, subtract mean values, scales values by scalefactor, swap Blue and Red channels.

Parameters
imagesinput images (all with 1-, 3- or 4-channels).
sizespatial size for output image
meanscalar with mean values which are subtracted from channels. Values are intended to be in (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
scalefactormultiplier for images values.
swapRBflag which indicates that swap first and last channels in 3-channel image is necessary.
cropflag which indicates whether image will be cropped after resize or not
ddepthDepth of output blob. Choose CV_32F or CV_8U.

if crop is true, input image is resized so one side after resize is equal to corresponding dimension in size and another one is equal or larger. Then, crop from the center is performed. If crop is false, direct resize without cropping and preserving aspect ratio is performed.

Returns
4-dimensional Mat with NCHW dimensions order.
Note
The order and usage of scalefactor and mean are (input - mean) * scalefactor.

◆ blobFromImagesWithParams() [1/4]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImagesWithParams ( List< Mat images,
Image2BlobParams  param 
)
static

Creates 4-dimensional blob from series of images with given params.

This function is an extension of blobFromImages to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.

Parameters
imagesinput image (all with 1-, 3- or 4-channels).
paramstruct of Image2BlobParams, contains all parameters needed by processing of image to blob.
Returns
4-dimensional Mat.

◆ blobFromImagesWithParams() [2/4]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImagesWithParams ( List< Mat images)
static

Creates 4-dimensional blob from series of images with given params.

This function is an extension of blobFromImages to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.

Parameters
imagesinput image (all with 1-, 3- or 4-channels).
paramstruct of Image2BlobParams, contains all parameters needed by processing of image to blob.
Returns
4-dimensional Mat.

◆ blobFromImagesWithParams() [3/4]

static void OpenCVForUnity.DnnModule.Dnn.blobFromImagesWithParams ( List< Mat images,
Mat  blob,
Image2BlobParams  param 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ blobFromImagesWithParams() [4/4]

static void OpenCVForUnity.DnnModule.Dnn.blobFromImagesWithParams ( List< Mat images,
Mat  blob 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ blobFromImageWithParams() [1/4]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImageWithParams ( Mat  image,
Image2BlobParams  param 
)
static

Creates 4-dimensional blob from image with given params.

This function is an extension of blobFromImage to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.

Parameters
imageinput image (all with 1-, 3- or 4-channels).
paramstruct of Image2BlobParams, contains all parameters needed by processing of image to blob.
Returns
4-dimensional Mat.

◆ blobFromImageWithParams() [2/4]

static Mat OpenCVForUnity.DnnModule.Dnn.blobFromImageWithParams ( Mat  image)
static

Creates 4-dimensional blob from image with given params.

This function is an extension of blobFromImage to meet more image preprocess needs. Given input image and preprocessing parameters, and function outputs the blob.

Parameters
imageinput image (all with 1-, 3- or 4-channels).
paramstruct of Image2BlobParams, contains all parameters needed by processing of image to blob.
Returns
4-dimensional Mat.

◆ blobFromImageWithParams() [3/4]

static void OpenCVForUnity.DnnModule.Dnn.blobFromImageWithParams ( Mat  image,
Mat  blob,
Image2BlobParams  param 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ blobFromImageWithParams() [4/4]

static void OpenCVForUnity.DnnModule.Dnn.blobFromImageWithParams ( Mat  image,
Mat  blob 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getAvailableTargets()

static List<int> OpenCVForUnity.DnnModule.Dnn.getAvailableTargets ( int  be)
static

◆ getInferenceEngineBackendType()

static string OpenCVForUnity.DnnModule.Dnn.getInferenceEngineBackendType ( )
static

Returns Inference Engine internal backend API.

See values of CV_DNN_BACKEND_INFERENCE_ENGINE_* macros.

OPENCV_DNN_BACKEND_INFERENCE_ENGINE_TYPE runtime parameter (environment variable) is ignored since 4.6.0.

Deprecated:

◆ getInferenceEngineCPUType()

static string OpenCVForUnity.DnnModule.Dnn.getInferenceEngineCPUType ( )
static

Returns Inference Engine CPU type.

Specify OpenVINO plugin: CPU or ARM.

◆ getInferenceEngineVPUType()

static string OpenCVForUnity.DnnModule.Dnn.getInferenceEngineVPUType ( )
static

Returns Inference Engine VPU type.

See values of CV_DNN_INFERENCE_ENGINE_VPU_TYPE_* macros.

◆ imagesFromBlob()

static void OpenCVForUnity.DnnModule.Dnn.imagesFromBlob ( Mat  blob_,
List< Mat images_ 
)
static

Parse a 4D blob and output the images it contains as 2D arrays through a simpler data structure (std::vector<cv::Mat>).

Parameters
[in]blob_4 dimensional array (images, channels, height, width) in floating point precision (CV_32F) from which you would like to extract the images.
[out]images_array of 2D Mat containing the images extracted from the blob in floating point precision (CV_32F). They are non normalized neither mean added. The number of returned images equals the first dimension of the blob (batch size). Every image has a number of channels equals to the second dimension of the blob (depth).

◆ NMSBoxes() [1/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxes ( MatOfRect2d  bboxes,
MatOfFloat  scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
float  eta,
int  top_k 
)
static

Performs non maximum suppression given boxes and corresponding scores.

Parameters
bboxesa set of bounding boxes to apply NMS.
scoresa set of corresponding confidences.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
etaa coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
top_kif >0, keep at most top_k picked indices.

◆ NMSBoxes() [2/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxes ( MatOfRect2d  bboxes,
MatOfFloat  scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
float  eta 
)
static

Performs non maximum suppression given boxes and corresponding scores.

Parameters
bboxesa set of bounding boxes to apply NMS.
scoresa set of corresponding confidences.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
etaa coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
top_kif >0, keep at most top_k picked indices.

◆ NMSBoxes() [3/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxes ( MatOfRect2d  bboxes,
MatOfFloat  scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices 
)
static

Performs non maximum suppression given boxes and corresponding scores.

Parameters
bboxesa set of bounding boxes to apply NMS.
scoresa set of corresponding confidences.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
etaa coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
top_kif >0, keep at most top_k picked indices.

◆ NMSBoxesBatched() [1/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxesBatched ( MatOfRect2d  bboxes,
MatOfFloat  scores,
MatOfInt  class_ids,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
float  eta,
int  top_k 
)
static

Performs batched non maximum suppression on given boxes and corresponding scores across different classes.

Parameters
bboxesa set of bounding boxes to apply NMS.
scoresa set of corresponding confidences.
class_idsa set of corresponding class ids. Ids are integer and usually start from 0.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
etaa coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
top_kif >0, keep at most top_k picked indices.

◆ NMSBoxesBatched() [2/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxesBatched ( MatOfRect2d  bboxes,
MatOfFloat  scores,
MatOfInt  class_ids,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
float  eta 
)
static

Performs batched non maximum suppression on given boxes and corresponding scores across different classes.

Parameters
bboxesa set of bounding boxes to apply NMS.
scoresa set of corresponding confidences.
class_idsa set of corresponding class ids. Ids are integer and usually start from 0.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
etaa coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
top_kif >0, keep at most top_k picked indices.

◆ NMSBoxesBatched() [3/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxesBatched ( MatOfRect2d  bboxes,
MatOfFloat  scores,
MatOfInt  class_ids,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices 
)
static

Performs batched non maximum suppression on given boxes and corresponding scores across different classes.

Parameters
bboxesa set of bounding boxes to apply NMS.
scoresa set of corresponding confidences.
class_idsa set of corresponding class ids. Ids are integer and usually start from 0.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
etaa coefficient in adaptive threshold formula: \(nms\_threshold_{i+1}=eta\cdot nms\_threshold_i\).
top_kif >0, keep at most top_k picked indices.

◆ NMSBoxesRotated() [1/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxesRotated ( MatOfRotatedRect  bboxes,
MatOfFloat  scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
float  eta,
int  top_k 
)
static

◆ NMSBoxesRotated() [2/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxesRotated ( MatOfRotatedRect  bboxes,
MatOfFloat  scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
float  eta 
)
static

◆ NMSBoxesRotated() [3/3]

static void OpenCVForUnity.DnnModule.Dnn.NMSBoxesRotated ( MatOfRotatedRect  bboxes,
MatOfFloat  scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices 
)
static

◆ readNet() [1/5]

static Net OpenCVForUnity.DnnModule.Dnn.readNet ( string  model,
string  config,
string  framework 
)
static

Read deep learning network represented in one of the supported formats.

Parameters
[in]modelBinary file contains trained weights. The following file extensions are expected for models from different frameworks:
[in]configText file contains network configuration. It could be a file with the following extensions:
[in]frameworkExplicit framework name tag to determine a format.
Returns
Net object.

This function automatically detects an origin framework of trained model and calls an appropriate function such readNetFromCaffe, readNetFromTensorflow, readNetFromTorch or readNetFromDarknet. An order of model and config arguments does not matter.

◆ readNet() [2/5]

static Net OpenCVForUnity.DnnModule.Dnn.readNet ( string  model,
string  config 
)
static

Read deep learning network represented in one of the supported formats.

Parameters
[in]modelBinary file contains trained weights. The following file extensions are expected for models from different frameworks:
[in]configText file contains network configuration. It could be a file with the following extensions:
[in]frameworkExplicit framework name tag to determine a format.
Returns
Net object.

This function automatically detects an origin framework of trained model and calls an appropriate function such readNetFromCaffe, readNetFromTensorflow, readNetFromTorch or readNetFromDarknet. An order of model and config arguments does not matter.

◆ readNet() [3/5]

static Net OpenCVForUnity.DnnModule.Dnn.readNet ( string  model)
static

Read deep learning network represented in one of the supported formats.

Parameters
[in]modelBinary file contains trained weights. The following file extensions are expected for models from different frameworks:
[in]configText file contains network configuration. It could be a file with the following extensions:
[in]frameworkExplicit framework name tag to determine a format.
Returns
Net object.

This function automatically detects an origin framework of trained model and calls an appropriate function such readNetFromCaffe, readNetFromTensorflow, readNetFromTorch or readNetFromDarknet. An order of model and config arguments does not matter.

◆ readNet() [4/5]

static Net OpenCVForUnity.DnnModule.Dnn.readNet ( string  framework,
MatOfByte  bufferModel,
MatOfByte  bufferConfig 
)
static

Read deep learning network represented in one of the supported formats.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]frameworkName of origin framework.
[in]bufferModelA buffer with a content of binary file with weights
[in]bufferConfigA buffer with a content of text file contains network configuration.
Returns
Net object.

◆ readNet() [5/5]

static Net OpenCVForUnity.DnnModule.Dnn.readNet ( string  framework,
MatOfByte  bufferModel 
)
static

Read deep learning network represented in one of the supported formats.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
[in]frameworkName of origin framework.
[in]bufferModelA buffer with a content of binary file with weights
[in]bufferConfigA buffer with a content of text file contains network configuration.
Returns
Net object.

◆ readNetFromCaffe() [1/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromCaffe ( string  prototxt,
string  caffeModel 
)
static

Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.

Parameters
prototxtpath to the .prototxt file with text description of the network architecture.
caffeModelpath to the .caffemodel file with learned network.
Returns
Net object.

◆ readNetFromCaffe() [2/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromCaffe ( string  prototxt)
static

Reads a network model stored in <a href="http://caffe.berkeleyvision.org">Caffe</a> framework's format.

Parameters
prototxtpath to the .prototxt file with text description of the network architecture.
caffeModelpath to the .caffemodel file with learned network.
Returns
Net object.

◆ readNetFromCaffe() [3/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromCaffe ( MatOfByte  bufferProto,
MatOfByte  bufferModel 
)
static

Reads a network model stored in Caffe model in memory.

Parameters
bufferProtobuffer containing the content of the .prototxt file
bufferModelbuffer containing the content of the .caffemodel file
Returns
Net object.

◆ readNetFromCaffe() [4/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromCaffe ( MatOfByte  bufferProto)
static

Reads a network model stored in Caffe model in memory.

Parameters
bufferProtobuffer containing the content of the .prototxt file
bufferModelbuffer containing the content of the .caffemodel file
Returns
Net object.

◆ readNetFromDarknet() [1/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromDarknet ( string  cfgFile,
string  darknetModel 
)
static

Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.

Parameters
cfgFilepath to the .cfg file with text description of the network architecture.
darknetModelpath to the .weights file with learned network.
Returns
Network object that ready to do forward, throw an exception in failure cases.

◆ readNetFromDarknet() [2/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromDarknet ( string  cfgFile)
static

Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.

Parameters
cfgFilepath to the .cfg file with text description of the network architecture.
darknetModelpath to the .weights file with learned network.
Returns
Network object that ready to do forward, throw an exception in failure cases.

◆ readNetFromDarknet() [3/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromDarknet ( MatOfByte  bufferCfg,
MatOfByte  bufferModel 
)
static

Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.

Parameters
bufferCfgA buffer contains a content of .cfg file with text description of the network architecture.
bufferModelA buffer contains a content of .weights file with learned network.
Returns
Net object.

◆ readNetFromDarknet() [4/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromDarknet ( MatOfByte  bufferCfg)
static

Reads a network model stored in <a href="https://pjreddie.com/darknet/">Darknet</a> model files.

Parameters
bufferCfgA buffer contains a content of .cfg file with text description of the network architecture.
bufferModelA buffer contains a content of .weights file with learned network.
Returns
Net object.

◆ readNetFromModelOptimizer() [1/3]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromModelOptimizer ( string  xml,
string  bin 
)
static

Load a network from Intel's Model Optimizer intermediate representation.

Parameters
[in]xmlXML configuration file with network's topology.
[in]binBinary file with trained weights.
Returns
Net object. Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend.

◆ readNetFromModelOptimizer() [2/3]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromModelOptimizer ( string  xml)
static

Load a network from Intel's Model Optimizer intermediate representation.

Parameters
[in]xmlXML configuration file with network's topology.
[in]binBinary file with trained weights.
Returns
Net object. Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend.

◆ readNetFromModelOptimizer() [3/3]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromModelOptimizer ( MatOfByte  bufferModelConfig,
MatOfByte  bufferWeights 
)
static

Load a network from Intel's Model Optimizer intermediate representation.

Parameters
[in]bufferModelConfigBuffer contains XML configuration with network's topology.
[in]bufferWeightsBuffer contains binary data with trained weights.
Returns
Net object. Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine backend.

◆ readNetFromONNX() [1/2]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromONNX ( string  onnxFile)
static

Reads a network model <a href="https://onnx.ai/">ONNX</a>.

Parameters
onnxFilepath to the .onnx file with text description of the network architecture.
Returns
Network object that ready to do forward, throw an exception in failure cases.

◆ readNetFromONNX() [2/2]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromONNX ( MatOfByte  buffer)
static

Reads a network model from <a href="https://onnx.ai/">ONNX</a> in-memory buffer.

Parameters
bufferin-memory buffer that stores the ONNX model bytes.
Returns
Network object that ready to do forward, throw an exception in failure cases.

◆ readNetFromTensorflow() [1/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTensorflow ( string  model,
string  config 
)
static

Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.

Parameters
modelpath to the .pb file with binary protobuf description of the network architecture
configpath to the .pbtxt file that contains text graph definition in protobuf format. Resulting Net object is built by text graph using weights from a binary one that let us make it more flexible.
Returns
Net object.

◆ readNetFromTensorflow() [2/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTensorflow ( string  model)
static

Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.

Parameters
modelpath to the .pb file with binary protobuf description of the network architecture
configpath to the .pbtxt file that contains text graph definition in protobuf format. Resulting Net object is built by text graph using weights from a binary one that let us make it more flexible.
Returns
Net object.

◆ readNetFromTensorflow() [3/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTensorflow ( MatOfByte  bufferModel,
MatOfByte  bufferConfig 
)
static

Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.

Parameters
bufferModelbuffer containing the content of the pb file
bufferConfigbuffer containing the content of the pbtxt file
Returns
Net object.

◆ readNetFromTensorflow() [4/4]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTensorflow ( MatOfByte  bufferModel)
static

Reads a network model stored in <a href="https://www.tensorflow.org/">TensorFlow</a> framework's format.

Parameters
bufferModelbuffer containing the content of the pb file
bufferConfigbuffer containing the content of the pbtxt file
Returns
Net object.

◆ readNetFromTFLite() [1/2]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTFLite ( string  model)
static

Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.

Parameters
modelpath to the .tflite file with binary flatbuffers description of the network architecture
Returns
Net object.

◆ readNetFromTFLite() [2/2]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTFLite ( MatOfByte  bufferModel)
static

Reads a network model stored in <a href="https://www.tensorflow.org/lite">TFLite</a> framework's format.

Parameters
bufferModelbuffer containing the content of the tflite file
Returns
Net object.

◆ readNetFromTorch() [1/3]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTorch ( string  model,
bool  isBinary,
bool  evaluate 
)
static

Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.

Parameters
modelpath to the file, dumped from Torch by using torch.save() function.
isBinaryspecifies whether the network was serialized in ascii mode or binary.
evaluatespecifies testing phase of network. If true, it's similar to evaluate() method in Torch.
Returns
Net object.
Note
Ascii mode of Torch serializer is more preferable, because binary mode extensively use long type of C language, which has various bit-length on different systems.

The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> object with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors.

List of supported layers (i.e. object instances derived from Torch nn.Module class):

  • nn.Sequential
  • nn.Parallel
  • nn.Concat
  • nn.Linear
  • nn.SpatialConvolution
  • nn.SpatialMaxPooling, nn.SpatialAveragePooling
  • nn.ReLU, nn.TanH, nn.Sigmoid
  • nn.Reshape
  • nn.SoftMax, nn.LogSoftMax

Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.

◆ readNetFromTorch() [2/3]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTorch ( string  model,
bool  isBinary 
)
static

Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.

Parameters
modelpath to the file, dumped from Torch by using torch.save() function.
isBinaryspecifies whether the network was serialized in ascii mode or binary.
evaluatespecifies testing phase of network. If true, it's similar to evaluate() method in Torch.
Returns
Net object.
Note
Ascii mode of Torch serializer is more preferable, because binary mode extensively use long type of C language, which has various bit-length on different systems.

The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> object with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors.

List of supported layers (i.e. object instances derived from Torch nn.Module class):

  • nn.Sequential
  • nn.Parallel
  • nn.Concat
  • nn.Linear
  • nn.SpatialConvolution
  • nn.SpatialMaxPooling, nn.SpatialAveragePooling
  • nn.ReLU, nn.TanH, nn.Sigmoid
  • nn.Reshape
  • nn.SoftMax, nn.LogSoftMax

Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.

◆ readNetFromTorch() [3/3]

static Net OpenCVForUnity.DnnModule.Dnn.readNetFromTorch ( string  model)
static

Reads a network model stored in <a href="http://torch.ch">Torch7</a> framework's format.

Parameters
modelpath to the file, dumped from Torch by using torch.save() function.
isBinaryspecifies whether the network was serialized in ascii mode or binary.
evaluatespecifies testing phase of network. If true, it's similar to evaluate() method in Torch.
Returns
Net object.
Note
Ascii mode of Torch serializer is more preferable, because binary mode extensively use long type of C language, which has various bit-length on different systems.

The loading file must contain serialized <a href="https://github.com/torch/nn/blob/master/doc/module.md">nn.Module</a> object with importing network. Try to eliminate a custom objects from serialazing data to avoid importing errors.

List of supported layers (i.e. object instances derived from Torch nn.Module class):

  • nn.Sequential
  • nn.Parallel
  • nn.Concat
  • nn.Linear
  • nn.SpatialConvolution
  • nn.SpatialMaxPooling, nn.SpatialAveragePooling
  • nn.ReLU, nn.TanH, nn.Sigmoid
  • nn.Reshape
  • nn.SoftMax, nn.LogSoftMax

Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.

◆ readTensorFromONNX()

static Mat OpenCVForUnity.DnnModule.Dnn.readTensorFromONNX ( string  path)
static

Creates blob from .pb file.

Parameters
pathto the .pb file with input tensor.
Returns
Mat.

◆ readTorchBlob() [1/2]

static Mat OpenCVForUnity.DnnModule.Dnn.readTorchBlob ( string  filename,
bool  isBinary 
)
static

Loads blob which was serialized as torch.Tensor object of Torch7 framework.

Warning
This function has the same limitations as readNetFromTorch().

◆ readTorchBlob() [2/2]

static Mat OpenCVForUnity.DnnModule.Dnn.readTorchBlob ( string  filename)
static

Loads blob which was serialized as torch.Tensor object of Torch7 framework.

Warning
This function has the same limitations as readNetFromTorch().

◆ releaseHDDLPlugin()

static void OpenCVForUnity.DnnModule.Dnn.releaseHDDLPlugin ( )
static

Release a HDDL plugin.

◆ resetMyriadDevice()

static void OpenCVForUnity.DnnModule.Dnn.resetMyriadDevice ( )
static

Release a Myriad device (binded by OpenCV).

Single Myriad device cannot be shared across multiple processes which uses Inference Engine's Myriad plugin.

◆ setInferenceEngineBackendType()

static string OpenCVForUnity.DnnModule.Dnn.setInferenceEngineBackendType ( string  newBackendType)
static

Specify Inference Engine internal backend API.

See values of CV_DNN_BACKEND_INFERENCE_ENGINE_* macros.

Returns
previous value of internal backend API
Deprecated:

◆ shrinkCaffeModel() [1/2]

static void OpenCVForUnity.DnnModule.Dnn.shrinkCaffeModel ( string  src,
string  dst,
List< string >  layersTypes 
)
static

Convert all weights of Caffe network to half precision floating point.

Parameters
srcPath to origin model from Caffe framework contains single precision floating point weights (usually has .caffemodel extension).
dstPath to destination model with updated weights.
layersTypesSet of layers types which parameters will be converted. By default, converts only Convolutional and Fully-Connected layers' weights.
Note
Shrinked model has no origin float32 weights so it can't be used in origin Caffe framework anymore. However the structure of data is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe. So the resulting model may be used there.

◆ shrinkCaffeModel() [2/2]

static void OpenCVForUnity.DnnModule.Dnn.shrinkCaffeModel ( string  src,
string  dst 
)
static

Convert all weights of Caffe network to half precision floating point.

Parameters
srcPath to origin model from Caffe framework contains single precision floating point weights (usually has .caffemodel extension).
dstPath to destination model with updated weights.
layersTypesSet of layers types which parameters will be converted. By default, converts only Convolutional and Fully-Connected layers' weights.
Note
Shrinked model has no origin float32 weights so it can't be used in origin Caffe framework anymore. However the structure of data is taken from NVidia's Caffe fork: https://github.com/NVIDIA/caffe. So the resulting model may be used there.

◆ softNMSBoxes() [1/3]

static void OpenCVForUnity.DnnModule.Dnn.softNMSBoxes ( MatOfRect  bboxes,
MatOfFloat  scores,
MatOfFloat  updated_scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
long  top_k,
float  sigma 
)
static

Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503.

Parameters
bboxesa set of bounding boxes to apply Soft NMS.
scoresa set of corresponding confidences.
updated_scoresa set of corresponding updated confidences.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
top_kkeep at most top_k picked indices.
sigmaparameter of Gaussian weighting.
methodGaussian or linear.
See also
SoftNMSMethod

◆ softNMSBoxes() [2/3]

static void OpenCVForUnity.DnnModule.Dnn.softNMSBoxes ( MatOfRect  bboxes,
MatOfFloat  scores,
MatOfFloat  updated_scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices,
long  top_k 
)
static

Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503.

Parameters
bboxesa set of bounding boxes to apply Soft NMS.
scoresa set of corresponding confidences.
updated_scoresa set of corresponding updated confidences.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
top_kkeep at most top_k picked indices.
sigmaparameter of Gaussian weighting.
methodGaussian or linear.
See also
SoftNMSMethod

◆ softNMSBoxes() [3/3]

static void OpenCVForUnity.DnnModule.Dnn.softNMSBoxes ( MatOfRect  bboxes,
MatOfFloat  scores,
MatOfFloat  updated_scores,
float  score_threshold,
float  nms_threshold,
MatOfInt  indices 
)
static

Performs soft non maximum suppression given boxes and corresponding scores. Reference: https://arxiv.org/abs/1704.04503.

Parameters
bboxesa set of bounding boxes to apply Soft NMS.
scoresa set of corresponding confidences.
updated_scoresa set of corresponding updated confidences.
score_thresholda threshold used to filter boxes by score.
nms_thresholda threshold used in non maximum suppression.
indicesthe kept indices of bboxes after NMS.
top_kkeep at most top_k picked indices.
sigmaparameter of Gaussian weighting.
methodGaussian or linear.
See also
SoftNMSMethod

◆ writeTextGraph()

static void OpenCVForUnity.DnnModule.Dnn.writeTextGraph ( string  model,
string  output 
)
static

Create a text representation for a binary network stored in protocol buffer format.

Parameters
[in]modelA path to binary network.
[in]outputA path to output text file to be created.
    @note To reduce output file size, trained weights are not included.

Member Data Documentation

◆ DNN_BACKEND_CANN

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_CANN = 0 + 8

◆ DNN_BACKEND_CUDA

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_CUDA = 0 + 5

◆ DNN_BACKEND_DEFAULT

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_DEFAULT = 0

◆ DNN_BACKEND_HALIDE

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_HALIDE = 0 + 1

◆ DNN_BACKEND_INFERENCE_ENGINE

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_INFERENCE_ENGINE = 0 + 2

◆ DNN_BACKEND_OPENCV

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_OPENCV = 0 + 3

◆ DNN_BACKEND_TIMVX

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_TIMVX = 0 + 7

◆ DNN_BACKEND_VKCOM

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_VKCOM = 0 + 4

◆ DNN_BACKEND_WEBNN

const int OpenCVForUnity.DnnModule.Dnn.DNN_BACKEND_WEBNN = 0 + 6

◆ DNN_LAYOUT_NCDHW

const int OpenCVForUnity.DnnModule.Dnn.DNN_LAYOUT_NCDHW = 3

◆ DNN_LAYOUT_NCHW

const int OpenCVForUnity.DnnModule.Dnn.DNN_LAYOUT_NCHW = 2

◆ DNN_LAYOUT_ND

const int OpenCVForUnity.DnnModule.Dnn.DNN_LAYOUT_ND = 1

◆ DNN_LAYOUT_NDHWC

const int OpenCVForUnity.DnnModule.Dnn.DNN_LAYOUT_NDHWC = 5

◆ DNN_LAYOUT_NHWC

const int OpenCVForUnity.DnnModule.Dnn.DNN_LAYOUT_NHWC = 4

◆ DNN_LAYOUT_PLANAR

const int OpenCVForUnity.DnnModule.Dnn.DNN_LAYOUT_PLANAR = 6

◆ DNN_LAYOUT_UNKNOWN

const int OpenCVForUnity.DnnModule.Dnn.DNN_LAYOUT_UNKNOWN = 0

◆ DNN_PMODE_CROP_CENTER

const int OpenCVForUnity.DnnModule.Dnn.DNN_PMODE_CROP_CENTER = 1

◆ DNN_PMODE_LETTERBOX

const int OpenCVForUnity.DnnModule.Dnn.DNN_PMODE_LETTERBOX = 2

◆ DNN_PMODE_NULL

const int OpenCVForUnity.DnnModule.Dnn.DNN_PMODE_NULL = 0

◆ DNN_TARGET_CPU

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_CPU = 0

◆ DNN_TARGET_CPU_FP16

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_CPU_FP16 = 0 + 10

◆ DNN_TARGET_CUDA

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_CUDA = 0 + 6

◆ DNN_TARGET_CUDA_FP16

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_CUDA_FP16 = 0 + 7

◆ DNN_TARGET_FPGA

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_FPGA = 0 + 5

◆ DNN_TARGET_HDDL

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_HDDL = 0 + 8

◆ DNN_TARGET_MYRIAD

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_MYRIAD = 0 + 3

◆ DNN_TARGET_NPU

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_NPU = 0 + 9

◆ DNN_TARGET_OPENCL

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_OPENCL = 0 + 1

◆ DNN_TARGET_OPENCL_FP16

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_OPENCL_FP16 = 0 + 2

◆ DNN_TARGET_VULKAN

const int OpenCVForUnity.DnnModule.Dnn.DNN_TARGET_VULKAN = 0 + 4

◆ SoftNMSMethod_SOFTNMS_GAUSSIAN

const int OpenCVForUnity.DnnModule.Dnn.SoftNMSMethod_SOFTNMS_GAUSSIAN = 2

◆ SoftNMSMethod_SOFTNMS_LINEAR

const int OpenCVForUnity.DnnModule.Dnn.SoftNMSMethod_SOFTNMS_LINEAR = 1

The documentation for this class was generated from the following file: