1 | initial version |
This is probably not entirely impossible. I appreciate the thought you've already put into the subject, it makes things easier.
The general case is almost certainly not something you can do without huge datasets and machine learning, or special cameras. However, you said it can take user input, such as positioning the camera. One of the big problems would be perspective. If the slope is going away from you as well as to one side, perspective will distort the inclined line and give you bad slope readings. If you can position the camera to be straight onto the side, it might be done.
At least the slope can be done. I don't think you need actual dimensions, just the slope. Getting actual dimensions is hard. I imagine you're checking that the slope is below some threshold?
Just as you said, the Hough transform would help for finding the lines, but it won't work in every scenario. I would be prepared for a quick, simple way for the user to input the corners. Three taps on the screen is enough.
No matter what you do (unless it's give up), the place to start is the TUTORIALS. Work your way through the Core and Image Processing modules. By then you'll know enough to experiment and try things out.