I'm having a hard time to code this python line in C++:
Python:
frame_nn = cv2.cvtColor(padded, cv2.COLOR_BGR2RGB).transpose(2,0,1).astype(np.float32)[None,]
What I already got:
cv::cvtColor(image_pd, image_pd, cv::COLOR_BGR2RGB);
image_pd.convertTo(image_f, CV_32F);
How do I transpose a 3D maxtrix / image in C++? Basically what is the equivalent of image = numpy.transpose(image, (2, 0, 1))
in C++?
cv::transpose()
will only transpose the first two dimensions, so it is not applicable if you really want to permute all 3 axes. – Sniffle