mexopencv  3.4.1
MEX interface for OpenCV library
Functions | Variables
anonymous_namespace{Net_.cpp} Namespace Reference

Functions

MatND MxArrayToBlob (const MxArray &arr)
 Create 4-dimensional blob from MATLAB array. More...
 
Net::LayerId MxArrayToLayerId (const MxArray &arr)
 Convert MxArray to cv::dnn::Net::LayerId. More...
 
vector< Net::LayerIdMxArrayToVectorLayerId (const MxArray &arr)
 Convert MxArray to std::vector<cv::dnn::Net::LayerId> More...
 
LayerParams MxArrayToLayerParams (const MxArray &arr)
 Convert MxArray to cv::dnn::LayerParams. More...
 
MxArray toStruct (const Ptr< Layer > &layer)
 Convert cv::Ptr<cv::dnn::Layer> to scalar struct. More...
 
MxArray toStruct (const vector< Ptr< Layer > > &layers)
 Convert std::vector<cv::Ptr<cv::dnn::Layer>> to struct array. More...
 
MxArray toMxArray (int64_t i)
 MxArray constructor from 64-bit integer. More...
 
Ptr< NetreadNetFrom (const string &type, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
 Create an instance of Net using options in arguments. More...
 

Variables

int last_id = 0
 Last object id to allocate. More...
 
map< int, Ptr< Net > > obj_
 Object container. More...
 
const ConstMap< string, int > BackendsMap
 Computation backends for option processing. More...
 
const ConstMap< string, int > TargetsMap
 Computation target devices for option processing. More...
 
const ConstMap< int, stringTargetsInvMap
 Computation target devices for option processing. More...
 

Function Documentation

◆ MxArrayToBlob()

MatND anonymous_namespace{Net_.cpp}::MxArrayToBlob ( const MxArray arr)

Create 4-dimensional blob from MATLAB array.

Parameters
arrinput MxArray object (numeric array).
Returns
blob 4-dimensional cv::MatND.
See also
MxArray::toMatND

Definition at line 43 of file Net_.cpp.

◆ MxArrayToLayerId()

Net::LayerId anonymous_namespace{Net_.cpp}::MxArrayToLayerId ( const MxArray arr)

Convert MxArray to cv::dnn::Net::LayerId.

Parameters
arrMxArray object. In one of the following forms:
  • a scalar integer.
  • a scalar double.
  • a string.
Returns
instance of LayerId struct (a typedef for cv::dnn::DictValue, which is a container for either a string, a double, or an integer.

Definition at line 65 of file Net_.cpp.

◆ MxArrayToLayerParams()

LayerParams anonymous_namespace{Net_.cpp}::MxArrayToLayerParams ( const MxArray arr)

Convert MxArray to cv::dnn::LayerParams.

Parameters
arrMxArray object. A scalar struct with the following fields:
  • dict: Scalar struct of key/value dictionary parameters.
  • blobs: Cell array of learned parameters stored as blobs.
  • name: Name of the layer instance (optional, used for internal purposes).
  • type: Type name which was used for creating layer by factory (optional).
Returns
instance of created LayerParams struct.

Definition at line 114 of file Net_.cpp.

◆ MxArrayToVectorLayerId()

vector<Net::LayerId> anonymous_namespace{Net_.cpp}::MxArrayToVectorLayerId ( const MxArray arr)

Convert MxArray to std::vector<cv::dnn::Net::LayerId>

Parameters
arrMxArray object. Ine one of the following forms:
  • a cell array of scalars (integers of doubles)
  • a cell array of strings
  • a numeric array of integers or doubles
Returns
vector of LayerId

Definition at line 82 of file Net_.cpp.

◆ readNetFrom()

Ptr<Net> anonymous_namespace{Net_.cpp}::readNetFrom ( const string type,
vector< MxArray >::const_iterator  first,
vector< MxArray >::const_iterator  last 
)

Create an instance of Net using options in arguments.

Parameters
typetype of network to import, one of:
  • "Caffe"
  • "Tensorflow"
  • "Torch"
  • "Darknet"
firstiterator at the beginning of the vector range
lastiterator at the end of the vector range
Returns
smart pointer to created Net

Definition at line 216 of file Net_.cpp.

◆ toMxArray()

MxArray anonymous_namespace{Net_.cpp}::toMxArray ( int64_t  i)

MxArray constructor from 64-bit integer.

Parameters
iint value.
Returns
MxArray object, a scalar int64 array.

Definition at line 197 of file Net_.cpp.

◆ toStruct() [1/2]

MxArray anonymous_namespace{Net_.cpp}::toStruct ( const Ptr< Layer > &  layer)

Convert cv::Ptr<cv::dnn::Layer> to scalar struct.

Parameters
layersmart pointer to an instance of Layer
Returns
scalar struct MxArray object

Definition at line 165 of file Net_.cpp.

◆ toStruct() [2/2]

MxArray anonymous_namespace{Net_.cpp}::toStruct ( const vector< Ptr< Layer > > &  layers)

Convert std::vector<cv::Ptr<cv::dnn::Layer>> to struct array.

Parameters
layersvector of smart pointers to layers
Returns
struct-array MxArray object

Definition at line 180 of file Net_.cpp.

Variable Documentation

◆ BackendsMap

const ConstMap<string,int> anonymous_namespace{Net_.cpp}::BackendsMap
Initial value:
DNN_BACKEND_DEFAULT
DNN_BACKEND_HALIDE
DNN_BACKEND_INFERENCE_ENGINE
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927

Computation backends for option processing.

Definition at line 22 of file Net_.cpp.

◆ last_id

int anonymous_namespace{Net_.cpp}::last_id = 0

Last object id to allocate.

Definition at line 17 of file Net_.cpp.

◆ obj_

map<int,Ptr<Net> > anonymous_namespace{Net_.cpp}::obj_

Object container.

Definition at line 19 of file Net_.cpp.

◆ TargetsInvMap

const ConstMap<int,string> anonymous_namespace{Net_.cpp}::TargetsInvMap
Initial value:
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927

Computation target devices for option processing.

Definition at line 33 of file Net_.cpp.

◆ TargetsMap

const ConstMap<string,int> anonymous_namespace{Net_.cpp}::TargetsMap
Initial value:
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927

Computation target devices for option processing.

Definition at line 28 of file Net_.cpp.