LSD enum now anonymous.
authorDaniel Angelov <dani_angelov@yahoo.com>
Mon, 15 Jul 2013 20:28:19 +0000 (23:28 +0300)
committerDaniel Angelov <dani_angelov@yahoo.com>
Mon, 15 Jul 2013 20:28:19 +0000 (23:28 +0300)
modules/imgproc/include/opencv2/imgproc.hpp
modules/imgproc/src/lsd.cpp

index f994a82..b4a5efb 100644 (file)
@@ -192,8 +192,7 @@ enum { HOUGH_STANDARD      = 0,
      };
 
 //! Variants of Line Segment Detector
-enum lsd_refine_lvl
-     { LSD_REFINE_NONE = 0,
+enum { LSD_REFINE_NONE = 0,
        LSD_REFINE_STD  = 1,
        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:
  *
  * @param _refine       How should the lines found be refined?
- *                      REFINE_NONE - No refinement applied.
- *                      REFINE_STD  - Standard refinement is applied. E.g. breaking arches into smaller line approximations.
- *                      REFINE_ADV  - Advanced refinement. Number of false alarms is calculated,
- *                                    lines are refined through increase of precision, decrement in size, etc.
+ *                      LSD_REFINE_NONE - No refinement applied.
+ *                      LSD_REFINE_STD  - Standard refinement is applied. E.g. breaking arches into smaller line approximations.
+ *                      LSD_REFINE_ADV  - Advanced refinement. Number of false alarms is calculated,
+ *                                        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 _sigma_scale  Sigma for Gaussian filter is computed as sigma = _sigma_scale/_scale.
  * @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 _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 _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024);
 
@@ -919,7 +918,7 @@ private:
     int roix, roiy;
 
     const double SCALE;
-    const lsd_refine_lvl doRefine;
+    const int doRefine;
     const double SIGMA_SCALE;
     const double QUANT;
     const double ANG_TH;
index 781ea12..aa56e02 100644 (file)
 //
 //M*/
 
-#include <vector>
-
 #include "precomp.hpp"
 
+#include <vector>
+
 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)
         :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)
@@ -201,9 +201,9 @@ void LSD::detect(const cv::InputArray _image, cv::OutputArray _lines, cv::Rect _
     flsd(lines, w, p, n);
 
     Mat(lines).copyTo(_lines);
-    if (w) Mat(*w).copyTo(_width);
-    if (p) Mat(*p).copyTo(_prec);
-    if (n) Mat(*n).copyTo(_nfa);
+    if(w) Mat(*w).copyTo(_width);
+    if(p) Mat(*p).copyTo(_prec);
+    if(n) Mat(*n).copyTo(_nfa);
 
     delete w;
     delete p;
@@ -220,7 +220,7 @@ void LSD::flsd(std::vector<Vec4i>& lines,
     const double rho = QUANT / sin(prec);    // gradient magnitude threshold
 
     std::vector<coorlist> list;
-    if (SCALE != 1)
+    if(SCALE != 1)
     {
         Mat gaussian_img;
         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
             {
-                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; }
             }