Why is there no error with `randn` when I remove the` cv :: `
I accidentally forgot the namespace cv::
when I used randn
it and it compiled without error. This is my code
#include <iostream>
#include <opencv2/core/core.hpp>
int main( int argc, char** argv )
{
std::cout << "\n%%( Random Generator )%%\n";
cv::Mat G = cv::Mat::ones(4,4, CV_64FC1);
cv::Mat m = cv::Mat::zeros(1,1, CV_64FC1);
cv::Mat s = cv::Mat::ones(1,1, CV_64FC1);
std::cout << G << std::endl;
randn(G, m, s);
std::cout << G << std::endl;
return 0;
}
I am running the code on Windows
cl /EHsc main.cpp /Fetest.exe /I D:\xxxx\opencv_2.4.10\build\include /link /LIBPATH:D:\xxxx\opencv_2.4.10\build\x86\vc12\lib opencv_core2410.lib
My question is, is this function defined from a namespace cv
?
+3
CroCo
source
to share
1 answer
You get an Argument-Dependent Search (ADL, also known as Koenig search). Essentially, the name is looked up in the namespace of the argument type G
, viz cv::
. ADL mainly assists in finding operators, but it also works with common named functions.
+6
Cheers and hth. - Alf
source
to share