user3411335
user3411335

Reputation:

Where is OpenCV's C++ noArray() in the Source Code?

Just a quick question..I grepped through the source and found so many hits, it was impossible to look through. Tried saving the output of grep to a file i.e.

grep -r "noArray" . >> search

and then searching through the "search "file for typedef and enum...but nothing came up,,,I would just like to find it so I can wrap it in C. Any help is appreciated

Upvotes: 3

Views: 2240

Answers (1)

BConic
BConic

Reputation: 8980

With OpenCV 2.4.8, the function is declared in modules\core\include\opencv2\core\core.hpp:1453:

CV_EXPORTS OutputArray noArray();

And it is defined in modules\core\src\matrix.cpp:1731:

static _OutputArray _none;
OutputArray noArray() { return _none; }

EDIT

_none is a static object of type _OutputArray initialized using the default constructor, which is empty (see modules\core\src\matrix.cpp:1332). Hence, as _OutputArray derives from _InputArray, the default constructor of _InputArray is also called. This second constructor is defined in modules\core\src\matrix.cpp:921 as follows:

_InputArray::_InputArray() : flags(0), obj(0) {}

where flags and obj are member variables of respective types int and void*. Hence _none is not a NULL pointer but it contains one.

Upvotes: 3

Related Questions