snip3r77:

Will it be ok if I just still to one or is there a better library than OpenCV?


You can use every library you like during data loading and processing, as long as you don’t need to use this operation inside the model and need Autograd to calculate the backward pass through it.
torchvision uses PIL as the default image library, but you can of course use OpenCV.
Note that the color format of OpenCV is BGR, while PIL and thus all pretrained models in torchvision use RGB, so you should transform the color channels if you want to feed these images to a pretrained model.



 snip3r77:

At the kernel level , when we apply a -ve to the pixel it will turn it to white(1) if it’s dark (255) and vice-versa ?


A -1 will invert the pixel values, so dark colors in a grayscale image should get bright and vice versa, yes.