Merge pull request #9034 from sovrasov:mats_from_initializer_list

Add constructors taking initializer_list for some of OpenCV data types (#9034)

* Add a constructor taking initializer_list for Matx

* Add a constructor taking initializer list for Mat and Mat_

* Add one more method to initialize Mat to the corresponding tutorial

* Add a note how to initialize Matx

* CV_CXX_11->CV_CXX11
This commit is contained in:
Vladislav Sovrasov
2017-07-14 20:17:09 +03:00
committed by Alexander Alekhin
parent 11626fe32c
commit e5fbb4f5d2
9 changed files with 118 additions and 15 deletions
@@ -102,7 +102,7 @@ int main()
double t1 = (double) getTickCount();
#ifdef CV_CXX_11
#ifdef CV_CXX11
//! [mandelbrot-parallel-call-cxx11]
parallel_for_(Range(0, mandelbrotImg.rows*mandelbrotImg.cols), [&](const Range& range){
@@ -58,7 +58,13 @@ int main(int,char**)
Mat C = (Mat_<double>(3,3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
cout << "C = " << endl << " " << C << endl << endl;
//! [comma]
// do the same with initializer_list
#ifdef CV_CXX11
//! [list]
C = (Mat_<double>({0, -1, 0, -1, 5, -1, 0, -1, 0})).reshape(3);
cout << "C = " << endl << " " << C << endl << endl;
//! [list]
#endif
//! [clone]
Mat RowClone = C.row(1).clone();
cout << "RowClone = " << endl << " " << RowClone << endl << endl;