C++ front end equivalent of python swapaxes


I have tried reading around to see if this question has been answered before, but haven’t found anything specific.

In python I could easily convert my image numpy array to cube using image.swapaxes(1, 2).swapaxes(0, 1)

or simply using image.transpose((2,0,1)) before converting to tensor for making inference.

Please is there any quick way of doing this assuming I have read in an image with opencv in the c++ front-end?

Any hint or example will be appreciated.

Does permute help?

Best regards


1 Like

Thanks, although I have just used cv::split to split and concatenate the channels, and seems to work.