Creating a 4D matrix with one 3 channel frame and another 1 channel frame

I had read one 3 channel frame(RGB) and another 1 channel frame(Depth frame) into memory and have access to the two pointers pointing to the respective frame data.

Can I create a 4D array using the both the pointers ?

Is there any constructor in the Mat class which supports something like the below one where I want to create a single 4D mat object from the color and depth frame data
Mat (4, const int *sizes, int type, **void rgb_data, void depth_data, const size_t *steps=0)

If not is there any other way I can memcpy both the color data and the depth data to a 4D mat ?

it is not “4D”, it is “4-channel”. a 4-channel picture has 3 dimensions: height, width, channel.