I started using from pathlib import Path in place of os.path.join() to concatenate my paths. Taking the following code into consideration:
from pathlib import Path
import cv2
rootfolder = "rootyrooty"
file = "alittlefile"
image_path = Path(rootfolder, file)
image = cv2.imread(image_path.as_posix())
I'm using image_path.as_posix() to get a full string so I can pass image_path into imread function. Directly typing image_path doesn't works since it returns WindowsPath('rootyrooty/alittlefile') but I need "rootyrooty/alittlefile" (Since imread accepts strings instead of windowsPath objects). Do I have to use another component from pathlib instead of Path so I can just feed image_path into imread function. Like:
from pathlib import thefunctionyetidontknow
image_path = thefunctionyetidontknow("rootyrooty","alittlefile")
print("image_path")
# returns "rootyrooty/alittlefile"
Thanks.