mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
LSD enum now anonymous.
This commit is contained in:
parent
d35601209e
commit
694d9ff2eb
@ -192,8 +192,7 @@ enum { HOUGH_STANDARD = 0,
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Variants of Line Segment Detector
|
//! Variants of Line Segment Detector
|
||||||
enum lsd_refine_lvl
|
enum { LSD_REFINE_NONE = 0,
|
||||||
{ LSD_REFINE_NONE = 0,
|
|
||||||
LSD_REFINE_STD = 1,
|
LSD_REFINE_STD = 1,
|
||||||
LSD_REFINE_ADV = 2
|
LSD_REFINE_ADV = 2
|
||||||
};
|
};
|
||||||
@ -844,10 +843,10 @@ public:
|
|||||||
* Create an LSD object. Specifying scale, number of subdivisions for the image, should the lines be refined and other constants as follows:
|
* Create an LSD object. Specifying scale, number of subdivisions for the image, should the lines be refined and other constants as follows:
|
||||||
*
|
*
|
||||||
* @param _refine How should the lines found be refined?
|
* @param _refine How should the lines found be refined?
|
||||||
* REFINE_NONE - No refinement applied.
|
* LSD_REFINE_NONE - No refinement applied.
|
||||||
* REFINE_STD - Standard refinement is applied. E.g. breaking arches into smaller line approximations.
|
* LSD_REFINE_STD - Standard refinement is applied. E.g. breaking arches into smaller line approximations.
|
||||||
* REFINE_ADV - Advanced refinement. Number of false alarms is calculated,
|
* LSD_REFINE_ADV - Advanced refinement. Number of false alarms is calculated,
|
||||||
* lines are refined through increase of precision, decrement in size, etc.
|
* lines are refined through increase of precision, decrement in size, etc.
|
||||||
* @param _scale The scale of the image that will be used to find the lines. Range (0..1].
|
* @param _scale The scale of the image that will be used to find the lines. Range (0..1].
|
||||||
* @param _sigma_scale Sigma for Gaussian filter is computed as sigma = _sigma_scale/_scale.
|
* @param _sigma_scale Sigma for Gaussian filter is computed as sigma = _sigma_scale/_scale.
|
||||||
* @param _quant Bound to the quantization error on the gradient norm.
|
* @param _quant Bound to the quantization error on the gradient norm.
|
||||||
@ -856,7 +855,7 @@ public:
|
|||||||
* @param _density_th Minimal density of aligned region points in rectangle.
|
* @param _density_th Minimal density of aligned region points in rectangle.
|
||||||
* @param _n_bins Number of bins in pseudo-ordering of gradient modulus.
|
* @param _n_bins Number of bins in pseudo-ordering of gradient modulus.
|
||||||
*/
|
*/
|
||||||
LSD(lsd_refine_lvl _refine = LSD_REFINE_STD, double _scale = 0.8,
|
LSD(int _refine = LSD_REFINE_STD, double _scale = 0.8,
|
||||||
double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5,
|
double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5,
|
||||||
double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024);
|
double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024);
|
||||||
|
|
||||||
@ -919,7 +918,7 @@ private:
|
|||||||
int roix, roiy;
|
int roix, roiy;
|
||||||
|
|
||||||
const double SCALE;
|
const double SCALE;
|
||||||
const lsd_refine_lvl doRefine;
|
const int doRefine;
|
||||||
const double SIGMA_SCALE;
|
const double SIGMA_SCALE;
|
||||||
const double QUANT;
|
const double QUANT;
|
||||||
const double ANG_TH;
|
const double ANG_TH;
|
||||||
|
@ -39,10 +39,10 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -163,7 +163,7 @@ inline double log_gamma_lanczos(const double& x)
|
|||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LSD::LSD(lsd_refine_lvl _refine, double _scale, double _sigma_scale, double _quant,
|
LSD::LSD(int _refine, double _scale, double _sigma_scale, double _quant,
|
||||||
double _ang_th, double _log_eps, double _density_th, int _n_bins)
|
double _ang_th, double _log_eps, double _density_th, int _n_bins)
|
||||||
:SCALE(_scale), doRefine(_refine), SIGMA_SCALE(_sigma_scale), QUANT(_quant),
|
:SCALE(_scale), doRefine(_refine), SIGMA_SCALE(_sigma_scale), QUANT(_quant),
|
||||||
ANG_TH(_ang_th), LOG_EPS(_log_eps), DENSITY_TH(_density_th), N_BINS(_n_bins)
|
ANG_TH(_ang_th), LOG_EPS(_log_eps), DENSITY_TH(_density_th), N_BINS(_n_bins)
|
||||||
@ -201,9 +201,9 @@ void LSD::detect(const cv::InputArray _image, cv::OutputArray _lines, cv::Rect _
|
|||||||
flsd(lines, w, p, n);
|
flsd(lines, w, p, n);
|
||||||
|
|
||||||
Mat(lines).copyTo(_lines);
|
Mat(lines).copyTo(_lines);
|
||||||
if (w) Mat(*w).copyTo(_width);
|
if(w) Mat(*w).copyTo(_width);
|
||||||
if (p) Mat(*p).copyTo(_prec);
|
if(p) Mat(*p).copyTo(_prec);
|
||||||
if (n) Mat(*n).copyTo(_nfa);
|
if(n) Mat(*n).copyTo(_nfa);
|
||||||
|
|
||||||
delete w;
|
delete w;
|
||||||
delete p;
|
delete p;
|
||||||
@ -220,7 +220,7 @@ void LSD::flsd(std::vector<Vec4i>& lines,
|
|||||||
const double rho = QUANT / sin(prec); // gradient magnitude threshold
|
const double rho = QUANT / sin(prec); // gradient magnitude threshold
|
||||||
|
|
||||||
std::vector<coorlist> list;
|
std::vector<coorlist> list;
|
||||||
if (SCALE != 1)
|
if(SCALE != 1)
|
||||||
{
|
{
|
||||||
Mat gaussian_img;
|
Mat gaussian_img;
|
||||||
const double sigma = (SCALE < 1)?(SIGMA_SCALE / SCALE):(SIGMA_SCALE);
|
const double sigma = (SCALE < 1)?(SIGMA_SCALE / SCALE):(SIGMA_SCALE);
|
||||||
@ -357,7 +357,7 @@ void LSD::ll_angle(const double& threshold, const unsigned int& n_bins, std::vec
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
angles_data[addr] = double(cv::fastAtan2(gx, -gy)) * DEG_TO_RADS; // gradient angle computation
|
angles_data[addr] = cv::fastAtan2(float(gx), float(-gy)) * DEG_TO_RADS; // gradient angle computation
|
||||||
if (norm > max_grad) { max_grad = norm; }
|
if (norm > max_grad) { max_grad = norm; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user