Pointer to Mat Variables
Hello, I want to add a dynamic array of Mat variebles, i.e. a 2D array of images. Simply suppose you are putting e.g. 3 rows and 4 columns of your images on the table. I write the following code:
Mat **img_array;
Mat temp = imread("Lena.tif", CV_LOAD_IMAGE_ANYDEPTH);
img_array = (Mat **)malloc(hor * sizeof(temp));
for (char i1 = 0;i1<hor;i1++)
{
img_array[i1] = (Mat *)malloc(ver * sizeof(temp));
}
puts("Initializing Image Array...");
for (i1 = 0; i1 < hor; i1++)
for (char j1 = 0; j1 < ver; j1++)
img_array[i1][j1] = Mat::zeros(rows, col, CV_8UC3);
hor, ver are the nuber of horizontal and vertical elements of each array and rows, col refer to the number of the pixels of each individual image. When I run the program, the following error is issued: Exception thrown at 0x00007FFCFFA28BCC (opencv_world320d.dll) in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. occurred Any Idea?