I have a pytorch tensor, let’s say images, of type <class 'torch.Tensor'> and of size torch.Size([32, 3, 300, 300]), so that images[i, :, :, :] represents the i-th out of 32 rgb 300x300 images.
I would like to plot some of these images, let’s say the first one, i.e., images[0, :, :, :] using opencv (cv2.imshow()). Could you help? Thank you!
Thanks for your response. I tried that but I got an opencv error (Source image must have 1, 3 or 4 channels in function cvConvertImage)… It seemed to me that it would be trivial, but it isn’t…
Why can’t we use torch tensors directly with Open cv without converting them to numpy? I run cv2.kmeans on large images and they’re very slow. Wondering if being able to run them on Tensors would be faster.