How to convert 3d array to 4d array using Mat::reshape
Hi, I have 3d RGB array I need to convert it to 4d RGBA array using reshape how to do that kindly help me. Basically x = np.reshape(x, (1,64,64,3)) this python operation i have to do in c++.
what is the purpose of it ? do you need seperate color planes ?
Because I need to pass is array to tvm compiled module, tvm module will take input as 4 dimension array in python i am reshaping it using numpy.reshape like (64, 64, 3) to (1. 64, 64, 3).
forget numpy for a moment, what about the order ? NHWC or NCHW ?
do you have some more hints on how you intend to use that ? (does twm even work with cv::Mat ?)
Yes, I am using cv::Mat read and store the image, it will store the image in cv::Mat as (64, 64, 3) here col = 64, rows = 64 and channels = 3. I have to reshape it to (1, 64, 64, 3).
Basically, I am doing in python:
similarly, I have to in c++ using opencv
does it need "interleaved pixels" or "seperate color channels" ?