Ask Your Question

What's the best approach to detect an inclined plane (wheelchair ramp) in a picture?

asked 2017-01-16 13:45:30 -0500

albarc gravatar image

First of all I want to establish my absolute newbie status in the field of computer vision, so please excuse any mistake or misconception that I may express.

I have to develop an application whose goal is to detect (and measure, if possible) wheelchair ramps in pictures of building entrances. I'm sorry I don't have enough karma to provide links or attach example pictures. Searching 'wheelchair accessible building' in google images provides some good examples.

This would be an Android app, running on a phone or tablet, making use of its camera. Its intended users are inspectors whose job is to determine if a building is wheelchair accessible. Ideally the app would automatically detect and measure the dimensions (particularly the slope) of any ramps found in the picture. It does not matter whether to use static pictures that the user has to "snap", or a running video in real-time, whatever works best. Input from the user, if practically feasible, could be included, such as providing a certain dimension reference, or having to position the camera in a certain way.

From what I've read about opencv, I have the following "starting points". First of all I would try to estimate the camera pose (which I understand makes it possible to transform the picture coordinates to world coordinates). Basically I would try to determine the direction of the main coordinate axes in order to detect "vertical" and "horizontal" planes in the image, i.e. walls and ground respectively.

I believe that the houghline transform would be useful in detecting straight lines, which then I would "group" into different sets according to their direction (basically obtaining the cartesian axes). Once this is done, I would try to detect the ramp by searching for "inclined" lines, i.e. lines not aligned with any of the cartesian axes.

I understand that finding real-life right angles in pictures is not straightforward given the changes in perspective. Is there any opencv function aimed at this particular detection? Also I would like to point out that in many of the pictures there would be stairs, so maybe they could be used to improve the detection or as some kind of dimension reference?

Do any of my reasonings make any sense? Am I completely overseeing or misunderstanding anything? Are there any other transforms or opencv functions that would be useful for my case? Can anyone point me to a better approach to the problem?

From my limited cv knowledge I feel like this is a complex problem, and that finding a fully automatic detector would be very difficult given the variability of building entrances that exist in the world. An answer along the lines of "this is practically impossible" or "this can't be done practically" is welcome, although I would very much appreciate any helpful advice, direction or explanation.

Excuse me for the long post, and thank you in advance for any help!

edit retag flag offensive close merge delete


I don't understand why you need opencv. You can fixed smartphone on a wheelchair and use acceloremeter and inclinometer to measure slope. I think you read this page and may be you will be able to find some help for your specific project

LBerger gravatar imageLBerger ( 2017-01-17 01:44:15 -0500 )edit

Thanks for your answer and your link, LBerger. However, the intended users of this app are building inspectors, not wheelchair users. Also, using image recognition is a requirement of the application.

albarc gravatar imagealbarc ( 2017-01-17 04:49:53 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-01-16 20:10:00 -0500

Tetragramm gravatar image

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.

edit flag offensive delete link more


Thank you so much for the answer. The advice about asking the user to input the three corners of the slope is actually quite useful. As you said, it's not essential to get the actual dimensions, the slope is the most important measurement. However, would it be completely impossible to get dimensions, even if some kind of reference is provided? I'll keep going through the tutorials, thanks again!

albarc gravatar imagealbarc ( 2017-01-17 04:57:11 -0500 )edit

Much harder. Not completely impossible, but much harder. Basically, you have to match a lot of points from a lot of images and back-calculate where the camera is. Then you have to have a reference or it's just arbitrary scale. Check out THIS set of lecture notes for a somewhat math heavy explanation. You say you're new to CV, but I don't know about your math. Also, if you go this way, you'll need the tutorials from ccalib3d module too.

Tetragramm gravatar imageTetragramm ( 2017-01-17 18:01:02 -0500 )edit

Question Tools

1 follower


Asked: 2017-01-16 13:45:30 -0500

Seen: 1,126 times

Last updated: Jan 16 '17