1 | initial version |
opencv is a c++ library, while your attempt at doing this is C, and it won't work.
please AVOID using pointers to cv::Mat, it's already a refcounted smartpointer on it's own. also malloc will only allocate memory, not construct objects.
use std::vector instead (and, please, read a c++ book):
vector< vector< Mat > >(hor, ver); //preallocated 2d array
for (i1 = 0; i1 < hor; i1++)
for (char j1 = 0; j1 < ver; j1++)
img_array[i1][j1] = Mat::zeros(rows, col, CV_8UC3);
2 | No.2 Revision |
opencv is a c++ library, while your attempt at doing this is C, and it won't work.
please AVOID using pointers to cv::Mat, it's already a refcounted smartpointer on it's own. also malloc will only allocate memory, not construct objects.
use std::vector instead (and, please, read a c++ book):
#include <vector>
using std::vector;
vector< vector< Mat > >(hor, ver); //preallocated 2d array
for (i1 = 0; i1 < hor; i1++)
for (char j1 = 0; j1 < ver; j1++)
img_array[i1][j1] = Mat::zeros(rows, col, CV_8UC3);
3 | No.3 Revision |
opencv is a c++ library, while your attempt at doing this is C, and it won't work.
please AVOID using pointers to cv::Mat, it's already a refcounted smartpointer on it's own. also malloc will only allocate memory, not construct objects.objects (and you also only allocated the outer array, not the inner ones).
use std::vector instead (and, please, read a c++ book):
#include <vector>
using std::vector;
vector< vector< Mat > >(hor, ver); //preallocated 2d array
for (i1 = 0; i1 < hor; i1++)
for (char j1 = 0; j1 < ver; j1++)
img_array[i1][j1] = Mat::zeros(rows, col, CV_8UC3);