Hi,
I used to use python version of opencv and now I’m switching to c++.
In python, it is easy to make multiple 3d images into a single 4d array which is a batch. Here is the python code imagining that I have 2 images (224 * 224 * 3).
int sz[] = {N,H,W,C};
Mat blob(4,sz, CV_32F); // preallocated
for (int n=0; n<N; n++) {
// get image n, convert to float, resize to W,H
Mat img = ....
// copy destination
Mat slice(H,W,CV_32FC3, blob.ptr(n));
img.copyTo(slice);
}