The cv2 library has an ability to use monocular vision to convert 2d still images into depthmaps using tensorflow and/or midas.
There's another more heavy handed way using a sobel edge finding routine and reconstructing contours or convex hull calculations (something that the midas model uses in its data set) but that's giving the cat the disease of a lion.
There's also online image converters using connected ai networks, but I'm guessing you're trying to create your own for easier access...so the cv2 + midas google search will be the easiest, although none of the neural network answers are ever 100% optimized, meaning performance will be questionable, even if it's "fast".