If you want to transform your images using torchvision.transforms, they should be read by using PIL and not opencv.
However Opencv is faster, so you need to create your own functions to transform your images if you want to use opencv.