# How can I calculate homography from the room height and camera calibration matrix?

EDIT2: I've added an assumption that the camera calibration matrix is given. Other factors (rotation, camera pose) are still not given.

I want to measure actual lengths of floor edges (blue lines in the example below) of a room by finding the homography matrix, from its length given in pixels (of blue lines in the second image).

We can use the camera calibration matrix, the height of the room (green lines in the example below), the room layout image (like the second image) and the assumption that the room follows Manhattan layout.

Example:

EDIT: I've removed some words that makes the question looks begging for an working code. Anyway, thank you for your answers. I've decided to take photos from our camera with drawing several lines parallel with the wall to do this.

• I might be missing something, but the only blue line that you could induce the length of in this picture is the far end. You can't tell how far the room extends behind the camera's field of view. – Marcus Müller May 30 at 9:57
• Also, none of these lines are visible in the picture, so OpenCV doesn't have any visual thing to work on. Maybe start with an empty room and work from there. You can try to find the wall lines from a room with furniture obstructing the view later on. – Marcus Müller May 30 at 9:59
• I've removed some words that makes the question looks begging for an working code. Anyway, thank you for your answers. I've decided to take photos from our camera with drawing several lines parallel with the wall to do this. – frozenca May 31 at 7:25
• @MarcusMüller Is it possible to calculate homography matrix by the image when we know the actual room ceiling height and the precise camera calibration matrix? Still don't-know-params are room width, rotation angle, camera pose, etc. – frozenca Jun 17 at 5:26