Class cv::line_descriptor::BinaryDescriptor::EDLineDetector#

Detailed Description#

This class is used to detect lines from input image. First, edges are extracted from input image following the method presented in Cihan Topal and Cuneyt Akinlar’s paper:”Edge Drawing: A Heuristic Approach to Robust Real-Time Edge Detection”, 2010. Then, lines are extracted from the edge image following the method presented in Cuneyt Akinlar and Cihan Topal’s paper:”EDLines: A real-time line segment detector with a false detection control”, 2011 PS: The linking step of edge detection has a little bit difference with the Edge drawing algorithm described in the paper. The edge chain doesn’t stop when the pixel direction is changed.

Constructor & Destructor Documentation#

EDLineDetector()#

cv::line_descriptor::BinaryDescriptor::EDLineDetector::EDLineDetector()

EDLineDetector()#

cv::line_descriptor::BinaryDescriptor::EDLineDetector::EDLineDetector(EDLineParam param)

~EDLineDetector()#

cv::line_descriptor::BinaryDescriptor::EDLineDetector::~EDLineDetector()

Member Function Documentation#

EdgeDrawing()#

int cv::line_descriptor::BinaryDescriptor::EDLineDetector::EdgeDrawing(
cv::Mat & image,
EdgeChains & edgeChains )

EDline()#

int cv::line_descriptor::BinaryDescriptor::EDLineDetector::EDline(cv::Mat & image)

extract line from image, and store them

EDline()#

int cv::line_descriptor::BinaryDescriptor::EDLineDetector::EDline(
cv::Mat & image,
LineChains & lines )

createEDLineDetector()#

static Ptr< EDLineDetector > cv::line_descriptor::BinaryDescriptor::EDLineDetector::createEDLineDetector()

Creates an EDLineDetector object, using smart pointers.

createEDLineDetector()#

static Ptr< EDLineDetector > cv::line_descriptor::BinaryDescriptor::EDLineDetector::createEDLineDetector(EDLineParam params)

InitEDLine_()#

void cv::line_descriptor::BinaryDescriptor::EDLineDetector::InitEDLine_()

LeastSquaresLineFit_()#

double cv::line_descriptor::BinaryDescriptor::EDLineDetector::LeastSquaresLineFit_(
unsigned int * xCors,
unsigned int * yCors,
unsigned int offsetS,
std::vector< double > & lineEquation )

LeastSquaresLineFit_()#

double cv::line_descriptor::BinaryDescriptor::EDLineDetector::LeastSquaresLineFit_(
unsigned int * xCors,
unsigned int * yCors,
unsigned int offsetS,
unsigned int newOffsetS,
unsigned int offsetE,
std::vector< double > & lineEquation )

LineValidation_()#

bool cv::line_descriptor::BinaryDescriptor::EDLineDetector::LineValidation_(
unsigned int * xCors,
unsigned int * yCors,
unsigned int offsetS,
unsigned int offsetE,
std::vector< double > & lineEquation,
float & direction )

Validate line based on the Helmholtz principle, which basically states that for a structure to be perceptually meaningful, the expectation of this structure by chance must be very low.

double_equal()#

static int cv::line_descriptor::BinaryDescriptor::EDLineDetector::double_equal(
double a,
double b )

Compare doubles by relative error. The resulting rounding error after floating point computations depend on the specific operations done. The same number computed by different algorithms could present different rounding errors. For a useful comparison, an estimation of the relative rounding error should be considered and compared to a factor times EPS. The factor should be related to the accumulated rounding error in the chain of computation. Here, as a simplification, a fixed factor is used.

log_gamma_lanczos()#

static double cv::line_descriptor::BinaryDescriptor::EDLineDetector::log_gamma_lanczos(double x)

Computes the natural logarithm of the absolute value of the gamma function of x using the Lanczos approximation. See http://www.rskey.org/gamma.htm The formula used is

\[ \Gamma(x) = \frac{ \sum_{n=0}^{N} q_n x^n }{ \Pi_{n=0}^{N} (x+n) } (x+5.5)^{x+0.5} e^{-(x+5.5)} \]

so

\[ \log\Gamma(x) = \log\left( \sum_{n=0}^{N} q_n x^n \right) + (x+0.5) \log(x+5.5) - (x+5.5) - \sum_{n=0}^{N} \log(x+n) \]

and q0 = 75122.6331530, q1 = 80916.6278952, q2 = 36308.2951477, q3 = 8687.24529705, q4 = 1168.92649479, q5 = 83.8676043424, q6 = 2.50662827511.

log_gamma_windschitl()#

static double cv::line_descriptor::BinaryDescriptor::EDLineDetector::log_gamma_windschitl(double x)

Computes the natural logarithm of the absolute value of the gamma function of x using Windschitl method. See http://www.rskey.org/gamma.htm The formula used is

\[ \Gamma(x) = \sqrt{\frac{2\pi}{x}} \left( \frac{x}{e} \sqrt{ x\sinh(1/x) + \frac{1}{810x^6} } \right)^x \]

so

\[ \log\Gamma(x) = 0.5\log(2\pi) + (x-0.5)\log(x) - x + 0.5x\log\left( x\sinh(1/x) + \frac{1}{810x^6} \right). \]

This formula is a good approximation when x > 15.

nfa()#

static double cv::line_descriptor::BinaryDescriptor::EDLineDetector::nfa(
int n,
int k,
double p,
double logNT )

Computes -log10(NFA). NFA stands for Number of False Alarms:

\[ \mathrm{NFA} = NT \cdot B(n,k,p) \]
  • NT - number of tests

  • B(n,k,p) - tail of binomial distribution with parameters n,k and p:

\[\begin{split} B(n,k,p) = \sum_{j=k}^n \left(\begin{array}{c}n\\j\end{array}\right) p^{j} (1-p)^{n-j} \end{split}\]

The value -log10(NFA) is equivalent but more intuitive than NFA:

  • -1 corresponds to 10 mean false alarms

  • 0 corresponds to 1 mean false alarm

  • 1 corresponds to 0.1 mean false alarms

  • 2 corresponds to 0.01 mean false alarms

  • … Used this way, the bigger the value, better the detection, and a logarithmic scale is used.

n k p

binomial parameters.

logNT

logarithm of Number of Tests The computation is based in the gamma function by the following relation: [ \left(\begin{array}{c}n\k\end{array}\right) = \frac{ \Gamma(n+1) }{ \Gamma(k+1) \cdot \Gamma(n-k+1) }. ] We use efficient algorithms to compute the logarithm of the gamma function. To make the computation faster, not all the sum is computed, part of the terms are neglected based on a bound to the error obtained (an error of 10% in the result is accepted).

Member Data Documentation#

anchorThreshold_#

unsigned char cv::line_descriptor::BinaryDescriptor::EDLineDetector::anchorThreshold_

dxImg_#

cv::Mat cv::line_descriptor::BinaryDescriptor::EDLineDetector::dxImg_

dyImg_#

cv::Mat cv::line_descriptor::BinaryDescriptor::EDLineDetector::dyImg_

gImgWO_#

cv::Mat cv::line_descriptor::BinaryDescriptor::EDLineDetector::gImgWO_

gradienThreshold_#

short cv::line_descriptor::BinaryDescriptor::EDLineDetector::gradienThreshold_

imageHeight#

unsigned int cv::line_descriptor::BinaryDescriptor::EDLineDetector::imageHeight

imageWidth#

unsigned int cv::line_descriptor::BinaryDescriptor::EDLineDetector::imageWidth

lineDirection_#

std::vector< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::lineDirection_

lineEndpoints_#

std::vector< std::vector< float > > cv::line_descriptor::BinaryDescriptor::EDLineDetector::lineEndpoints_

lineEquations_#

std::vector< std::vector< double > > cv::line_descriptor::BinaryDescriptor::EDLineDetector::lineEquations_

lineFitErrThreshold_#

double cv::line_descriptor::BinaryDescriptor::EDLineDetector::lineFitErrThreshold_

lines_#

LineChains cv::line_descriptor::BinaryDescriptor::EDLineDetector::lines_

lineSalience_#

std::vector< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::lineSalience_

minLineLen_#

int cv::line_descriptor::BinaryDescriptor::EDLineDetector::minLineLen_

scanIntervals_#

unsigned int cv::line_descriptor::BinaryDescriptor::EDLineDetector::scanIntervals_

ATA#

cv::Mat_< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::ATA

ATV#

cv::Mat_< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::ATV

bValidate_#

bool cv::line_descriptor::BinaryDescriptor::EDLineDetector::bValidate_

dirImg_#

cv::Mat cv::line_descriptor::BinaryDescriptor::EDLineDetector::dirImg_

edgeImage_#

cv::Mat cv::line_descriptor::BinaryDescriptor::EDLineDetector::edgeImage_

fitMatT#

cv::Mat_< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::fitMatT

fitVec#

cv::Mat_< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::fitVec

gImg_#

cv::Mat cv::line_descriptor::BinaryDescriptor::EDLineDetector::gImg_

ksize_#

int cv::line_descriptor::BinaryDescriptor::EDLineDetector::ksize_

logNT_#

double cv::line_descriptor::BinaryDescriptor::EDLineDetector::logNT_

pAnchorX_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pAnchorX_

pAnchorY_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pAnchorY_

pFirstPartEdgeS_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pFirstPartEdgeS_

pFirstPartEdgeX_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pFirstPartEdgeX_

pFirstPartEdgeY_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pFirstPartEdgeY_

pSecondPartEdgeS_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pSecondPartEdgeS_

pSecondPartEdgeX_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pSecondPartEdgeX_

pSecondPartEdgeY_#

unsigned int * cv::line_descriptor::BinaryDescriptor::EDLineDetector::pSecondPartEdgeY_

sigma_#

float cv::line_descriptor::BinaryDescriptor::EDLineDetector::sigma_

tempMatLineFit#

cv::Mat_< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::tempMatLineFit

tempVecLineFit#

cv::Mat_< float > cv::line_descriptor::BinaryDescriptor::EDLineDetector::tempVecLineFit