KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros
vanishing_point_detector.cpp File Reference
#include "edge_cpp/vanishing_point_detector.h"
#include "sample/sample_misc.h"
#include "n/n_diagonalize.h"
#include "n/n_cholesky.h"
#include "n/n_invert.h"
#include <cmath>
#include <iostream>

Macros

#define INFINITY_APPROXIMATION   100000000
 
#define VPD_HORIZONTAL_VANISHING_POINTS_RANSAC_PARAMETERS   4
 
#define VPD_VERTICAL_VANISHING_POINTS_RANSAC_PARAMETERS   2
 
#define VPD_VANISHING_POINTS_ESTIMATED_INLIER_RATIO   0.15
 
#define VPD_MIN_FOCAL_LENGTH   150 /*150 */
 
#define VPD_MAX_FOCAL_LENGTH   5000 /*800 */
 
#define VPD_CHECK_FOCAL_LENGTH   1000 /*800 */
 
#define VPD_SIGMA   1.2 /*1.2 */
 
#define VPD_START_CANNY_THRESHOLD   2.55 /*2.55 */
 
#define VPD_END_CANNY_THRESHOLD   2.04 /*2.04 */
 
#define VPD_EDGE_PADDING   30
 
#define VPD_BREAK_EDGE_SHORT_WINDOW_SIZE   7
 
#define VPD_BREAK_EDGE_LARGE_WINDOW_SIZE   60
 
#define VPD_BREAK_EDGE_SHORT_WINDOW_THRESHOLD   0.85
 
#define VPD_BREAK_EDGE_LARGE_WINDOW_THRESHOLD   0.97
 
#define VPD_SMALL_IMAGE_START_MIN_EDGE_LENGTH   5
 
#define VPD_NORMAL_IMAGE_START_MIN_EDGE_LENGTH   15
 
#define VPD_BIG_IMAGE_START_MIN_EDGE_LENGTH   30
 
#define VPD_RELAXED_EDGE_LENGTH   10
 
#define VPD_EDGE_LENGTH_INCREMENT   5
 
#define VPD_MAX_EDGE_LENGTH   51
 
#define VPD_MAX_OUTLIER_RATIO_INCREMENT   0.05
 
#define VPD_MAX_OUTLIER_RATIO   0.8
 
#define VPD_RANSAC_OUTLIER_THRESHOLD   0.06 /*0.06 */
 
#define VPD_RANSAC_STRICT_MAX_OUTLIER_RATIO   0.05 /*0.05 */
 
#define VPD_RANSAC_MAX_OUTLIER_RATIO   0.3
 
#define MIN_SEGMENT_LENGTH_ALLOWED   14.998
 
#define SMALL_IMAGE_MAX_SIZE   280
 
#define BIG_IMAGE_MIN_SIZE   500
 
#define VPD_DEFAULT_FOCAL_LENGTH_VALUE   350
 

Macro Definition Documentation

#define BIG_IMAGE_MIN_SIZE   500
#define INFINITY_APPROXIMATION   100000000

This is an approximation of the position of the vanishing points located at infinity

#define MIN_SEGMENT_LENGTH_ALLOWED   14.998
#define SMALL_IMAGE_MAX_SIZE   280
#define VPD_BIG_IMAGE_START_MIN_EDGE_LENGTH   30
#define VPD_BREAK_EDGE_LARGE_WINDOW_SIZE   60
#define VPD_BREAK_EDGE_LARGE_WINDOW_THRESHOLD   0.97
#define VPD_BREAK_EDGE_SHORT_WINDOW_SIZE   7

Other parameters we need in robustly_estimate_vanishing_points

#define VPD_BREAK_EDGE_SHORT_WINDOW_THRESHOLD   0.85
#define VPD_CHECK_FOCAL_LENGTH   1000 /*800 */
#define VPD_DEFAULT_FOCAL_LENGTH_VALUE   350

This is used to give a reasonable value for the focal length when it cannot be computed

#define VPD_EDGE_LENGTH_INCREMENT   5
#define VPD_EDGE_PADDING   30
#define VPD_END_CANNY_THRESHOLD   2.04 /*2.04 */
#define VPD_HORIZONTAL_VANISHING_POINTS_RANSAC_PARAMETERS   4

Default parameters for a Ransac run. We need 4 lines (parameters) to find two pairs of horizontal vanishing points (one pair each).

#define VPD_MAX_EDGE_LENGTH   51
#define VPD_MAX_FOCAL_LENGTH   5000 /*800 */
#define VPD_MAX_OUTLIER_RATIO   0.8
#define VPD_MAX_OUTLIER_RATIO_INCREMENT   0.05
#define VPD_MIN_FOCAL_LENGTH   150 /*150 */

When we check the consistency of a triplet of vanishing point, we expect the focal_length computed for them to be ipositive and possibly not too small

#define VPD_NORMAL_IMAGE_START_MIN_EDGE_LENGTH   15
#define VPD_RANSAC_MAX_OUTLIER_RATIO   0.3
#define VPD_RANSAC_OUTLIER_THRESHOLD   0.06 /*0.06 */
#define VPD_RANSAC_STRICT_MAX_OUTLIER_RATIO   0.05 /*0.05 */
#define VPD_RELAXED_EDGE_LENGTH   10
#define VPD_SIGMA   1.2 /*1.2 */

All the following defines are used in the in the function robustly_estimate_vanishing_points. Please see the comments there for further detailsFor edge detection

#define VPD_SMALL_IMAGE_START_MIN_EDGE_LENGTH   5
#define VPD_START_CANNY_THRESHOLD   2.55 /*2.55 */
#define VPD_VANISHING_POINTS_ESTIMATED_INLIER_RATIO   0.15

The default expected percentage of inliers among the input points. This is a very rough and inaccurate estimate. It is actually a lower bound so that the algorithm is more robust. I figured it is wise to run RANSAC a little longer since very few lines will intersect exactly at their vanishing point due to noise, and if we don't run it long enough we may get a vanishing point that is a little off its correct position

#define VPD_VERTICAL_VANISHING_POINTS_RANSAC_PARAMETERS   2

We need 2 lines (parameters) to find the vertical vanishing point