As an artist, being able to understand how rules of perspectival space are applied to real world spaces is useful for me to train my own perspective skills. Written using skills learned in my Digital Image Processing class, this is a prototype for a Matlab script that passes in an image of an urban scene and detects the vanishing points and horizon line of the image.
The most common perspectival images artists will render are 1-point perspective and 2-point perspective images, describing the respective number of horizontal vanishing points present in the image. As such, the tool is designed to detect vertical and horizontal perspective lines in an input image using a Hough Transform. The detected horizon lines are then projected onto a Gaussian sphere as proposed by S. Barnard and a primary horizontal vanishing point is determined based on where the lines intersect. Then, a horizon line is extracted from a vertical vanishing point calculated from the vertical perspective lines detected. This horizon line is used to then detect if there is a second prominent horizontal vanishing point in the image.
Blue lines are the measured horizon lines. Red dots are the primary vanishing point and blue dots are the secondary vanishing point.
Extracting Perspective Lines:
Finding the First Horizontal Vanishing Point
Finding the Horizon Line
Finding the Second Horizontal Vanishing Point
© 2020 all rights reserved Mohar Kalra.