Merge pull request #12246 from sturkmen72:move_enums
authorSuleyman TURKMEN <sturkmen@hotmail.com>
Fri, 24 Aug 2018 08:11:34 +0000 (11:11 +0300)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 24 Aug 2018 08:11:34 +0000 (11:11 +0300)
* Update core.hpp

* Update imgproc.hpp

* Update ImgprocTest.java

* Update CameraCalibrator.java

* Update OnCameraFrameRender.java

* Update FindContoursDemo.java

* Update IntroductionToSVMDemo.java

* Update NonLinearSVMsDemo.java

* Update IntroductionToPCADemo.java

* Update Smoothing.java

* Update MainActivity.java

* Update CalcBackProjectDemo1.java

* Update CornerSubPixDemo.java

* Update CornerDetectorDemo.java

* Update GoodFeaturesToTrackDemo.java

15 files changed:
modules/core/include/opencv2/core.hpp
modules/imgproc/include/opencv2/imgproc.hpp
modules/imgproc/misc/java/test/ImgprocTest.java
samples/android/camera-calibration/src/org/opencv/samples/cameracalibration/CameraCalibrator.java
samples/android/camera-calibration/src/org/opencv/samples/cameracalibration/OnCameraFrameRender.java
samples/android/mobilenet-objdetect/src/org/opencv/samples/opencv_mobilenet/MainActivity.java
samples/java/tutorial_code/Histograms_Matching/back_projection/CalcBackProjectDemo1.java
samples/java/tutorial_code/ImgProc/Smoothing/Smoothing.java
samples/java/tutorial_code/ShapeDescriptors/find_contours/FindContoursDemo.java
samples/java/tutorial_code/TrackingMotion/corner_subpixels/CornerSubPixDemo.java
samples/java/tutorial_code/TrackingMotion/generic_corner_detector/CornerDetectorDemo.java
samples/java/tutorial_code/TrackingMotion/good_features_to_track/GoodFeaturesToTrackDemo.java
samples/java/tutorial_code/ml/introduction_to_pca/IntroductionToPCADemo.java
samples/java/tutorial_code/ml/introduction_to_svm/IntroductionToSVMDemo.java
samples/java/tutorial_code/ml/non_linear_svms/NonLinearSVMsDemo.java

index a13ee6e..2abcb98 100644 (file)
@@ -211,27 +211,6 @@ enum KmeansFlags {
     KMEANS_USE_INITIAL_LABELS = 1
 };
 
-//! type of line
-enum LineTypes {
-    FILLED  = -1,
-    LINE_4  = 4, //!< 4-connected line
-    LINE_8  = 8, //!< 8-connected line
-    LINE_AA = 16 //!< antialiased line
-};
-
-//! Only a subset of Hershey fonts <https://en.wikipedia.org/wiki/Hershey_fonts> are supported
-enum HersheyFonts {
-    FONT_HERSHEY_SIMPLEX        = 0, //!< normal size sans-serif font
-    FONT_HERSHEY_PLAIN          = 1, //!< small size sans-serif font
-    FONT_HERSHEY_DUPLEX         = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
-    FONT_HERSHEY_COMPLEX        = 3, //!< normal size serif font
-    FONT_HERSHEY_TRIPLEX        = 4, //!< normal size serif font (more complex than FONT_HERSHEY_COMPLEX)
-    FONT_HERSHEY_COMPLEX_SMALL  = 5, //!< smaller version of FONT_HERSHEY_COMPLEX
-    FONT_HERSHEY_SCRIPT_SIMPLEX = 6, //!< hand-writing style font
-    FONT_HERSHEY_SCRIPT_COMPLEX = 7, //!< more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX
-    FONT_ITALIC                 = 16 //!< flag for italic font
-};
-
 enum ReduceTypes { REDUCE_SUM = 0, //!< the output is the sum of all rows/columns of the matrix.
                    REDUCE_AVG = 1, //!< the output is the mean vector of all rows/columns of the matrix.
                    REDUCE_MAX = 2, //!< the output is the maximum (column/row-wise) of all rows/columns of the matrix.
index ab1b788..893d767 100644 (file)
@@ -788,6 +788,46 @@ enum RectanglesIntersectTypes {
     INTERSECT_FULL  = 2 //!< One of the rectangle is fully enclosed in the other
 };
 
+
+/** types of line
+@ingroup imgproc_draw
+*/
+enum LineTypes {
+    FILLED  = -1,
+    LINE_4  = 4, //!< 4-connected line
+    LINE_8  = 8, //!< 8-connected line
+    LINE_AA = 16 //!< antialiased line
+};
+
+/** Only a subset of Hershey fonts <https://en.wikipedia.org/wiki/Hershey_fonts> are supported
+@ingroup imgproc_draw
+*/
+enum HersheyFonts {
+    FONT_HERSHEY_SIMPLEX        = 0, //!< normal size sans-serif font
+    FONT_HERSHEY_PLAIN          = 1, //!< small size sans-serif font
+    FONT_HERSHEY_DUPLEX         = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
+    FONT_HERSHEY_COMPLEX        = 3, //!< normal size serif font
+    FONT_HERSHEY_TRIPLEX        = 4, //!< normal size serif font (more complex than FONT_HERSHEY_COMPLEX)
+    FONT_HERSHEY_COMPLEX_SMALL  = 5, //!< smaller version of FONT_HERSHEY_COMPLEX
+    FONT_HERSHEY_SCRIPT_SIMPLEX = 6, //!< hand-writing style font
+    FONT_HERSHEY_SCRIPT_COMPLEX = 7, //!< more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX
+    FONT_ITALIC                 = 16 //!< flag for italic font
+};
+
+/** Possible set of marker types used for the cv::drawMarker function
+@ingroup imgproc_draw
+*/
+enum MarkerTypes
+{
+    MARKER_CROSS = 0,           //!< A crosshair marker shape
+    MARKER_TILTED_CROSS = 1,    //!< A 45 degree tilted crosshair marker shape
+    MARKER_STAR = 2,            //!< A star marker shape, combination of cross and tilted cross
+    MARKER_DIAMOND = 3,         //!< A diamond marker shape
+    MARKER_SQUARE = 4,          //!< A square marker shape
+    MARKER_TRIANGLE_UP = 5,     //!< An upwards pointing triangle marker shape
+    MARKER_TRIANGLE_DOWN = 6    //!< A downwards pointing triangle marker shape
+};
+
 //! finds arbitrary template in the grayscale image using Generalized Hough Transform
 class CV_EXPORTS GeneralizedHough : public Algorithm
 {
@@ -4430,18 +4470,6 @@ CV_EXPORTS_W void ellipse(InputOutputArray img, const RotatedRect& box, const Sc
 /* ADDING A SET OF PREDEFINED MARKERS WHICH COULD BE USED TO HIGHLIGHT POSITIONS IN AN IMAGE */
 /* ----------------------------------------------------------------------------------------- */
 
-//! Possible set of marker types used for the cv::drawMarker function
-enum MarkerTypes
-{
-    MARKER_CROSS = 0,           //!< A crosshair marker shape
-    MARKER_TILTED_CROSS = 1,    //!< A 45 degree tilted crosshair marker shape
-    MARKER_STAR = 2,            //!< A star marker shape, combination of cross and tilted cross
-    MARKER_DIAMOND = 3,         //!< A diamond marker shape
-    MARKER_SQUARE = 4,          //!< A square marker shape
-    MARKER_TRIANGLE_UP = 5,     //!< An upwards pointing triangle marker shape
-    MARKER_TRIANGLE_DOWN = 6    //!< A downwards pointing triangle marker shape
-};
-
 /** @brief Draws a marker on a predefined position in an image.
 
 The function cv::drawMarker draws a marker on a given position in the image. For the moment several
index ca23ee3..fb9dbf6 100644 (file)
@@ -1938,8 +1938,8 @@ public class ImgprocTest extends OpenCVTestCase {
         int thickness = 3;
         int baseLine[] = new int[1];
 
-        Imgproc.getTextSize(text, Core.FONT_HERSHEY_SCRIPT_SIMPLEX, fontScale, thickness, null);
-        Size res = Imgproc.getTextSize(text, Core.FONT_HERSHEY_SCRIPT_SIMPLEX, fontScale, thickness, baseLine);
+        Imgproc.getTextSize(text, Imgproc.FONT_HERSHEY_SCRIPT_SIMPLEX, fontScale, thickness, null);
+        Size res = Imgproc.getTextSize(text, Imgproc.FONT_HERSHEY_SCRIPT_SIMPLEX, fontScale, thickness, baseLine);
 
         assertEquals(543.0, res.width);
         assertEquals(44.0, res.height);
@@ -1961,7 +1961,7 @@ public class ImgprocTest extends OpenCVTestCase {
         int radius = Math.min(gray0.cols() / 4, gray0.rows() / 4);
         Scalar color = new Scalar(128);
 
-        Imgproc.circle(gray0, center, radius, color, Core.FILLED);
+        Imgproc.circle(gray0, center, radius, color, Imgproc.FILLED);
 
         assertTrue(0 != Core.countNonZero(gray0));
     }
@@ -2042,7 +2042,7 @@ public class ImgprocTest extends OpenCVTestCase {
         Size axes = new Size(2, 2);
         double angle = 30, startAngle = 60, endAngle = 90;
 
-        Imgproc.ellipse(gray0, center, axes, angle, startAngle, endAngle, colorWhite, Core.FILLED);
+        Imgproc.ellipse(gray0, center, axes, angle, startAngle, endAngle, colorWhite, Imgproc.FILLED);
 
         assertTrue(0 != Core.countNonZero(gray0));
     }
@@ -2054,11 +2054,11 @@ public class ImgprocTest extends OpenCVTestCase {
         Size axes2 = new Size(4, 4);
         double angle = 30, startAngle = 0, endAngle = 30;
 
-        Imgproc.ellipse(gray0, center, axes, angle, startAngle, endAngle, colorWhite, Core.FILLED, Imgproc.LINE_4, 0);
+        Imgproc.ellipse(gray0, center, axes, angle, startAngle, endAngle, colorWhite, Imgproc.FILLED, Imgproc.LINE_4, 0);
 
         assertTrue(0 != Core.countNonZero(gray0));
 
-        Imgproc.ellipse(gray0, center2, axes2, angle, startAngle, endAngle, colorBlack, Core.FILLED, Imgproc.LINE_4, 1);
+        Imgproc.ellipse(gray0, center2, axes2, angle, startAngle, endAngle, colorBlack, Imgproc.FILLED, Imgproc.LINE_4, 1);
 
         assertEquals(0, Core.countNonZero(gray0));
     }
@@ -2096,7 +2096,7 @@ public class ImgprocTest extends OpenCVTestCase {
         Size size = new Size(matSize / 4, matSize / 2);
         RotatedRect box = new RotatedRect(center, size, 45);
 
-        Imgproc.ellipse(gray0, box, new Scalar(1), Core.FILLED);
+        Imgproc.ellipse(gray0, box, new Scalar(1), Imgproc.FILLED);
         Imgproc.ellipse(gray0, box, new Scalar(0));
 
         assertTrue(0 < Core.countNonZero(gray0));
@@ -2159,11 +2159,11 @@ public class ImgprocTest extends OpenCVTestCase {
         Mat img = new Mat(20 + (int) labelSize.height, 20 + (int) labelSize.width, CvType.CV_8U, colorBlack);
         Point origin = new Point(10, labelSize.height + 10);
 
-        Imgproc.putText(img, text, origin, Core.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite);
+        Imgproc.putText(img, text, origin, Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite);
 
         assertTrue(Core.countNonZero(img) > 0);
         // check that border is not corrupted
-        Imgproc.rectangle(img, new Point(11, 11), new Point(labelSize.width + 10, labelSize.height + 10), colorBlack, Core.FILLED);
+        Imgproc.rectangle(img, new Point(11, 11), new Point(labelSize.width + 10, labelSize.height + 10), colorBlack, Imgproc.FILLED);
         assertEquals(0, Core.countNonZero(img));
     }
 
@@ -2173,11 +2173,11 @@ public class ImgprocTest extends OpenCVTestCase {
         Mat img = new Mat(20 + (int) labelSize.height, 20 + (int) labelSize.width, CvType.CV_8U, colorBlack);
         Point origin = new Point(10, labelSize.height + 10);
 
-        Imgproc.putText(img, text, origin, Core.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite, 2);
+        Imgproc.putText(img, text, origin, Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite, 2);
 
         assertTrue(Core.countNonZero(img) > 0);
         // check that border is not corrupted
-        Imgproc.rectangle(img, new Point(10, 10), new Point(labelSize.width + 10 + 1, labelSize.height + 10 + 1), colorBlack, Core.FILLED);
+        Imgproc.rectangle(img, new Point(10, 10), new Point(labelSize.width + 10 + 1, labelSize.height + 10 + 1), colorBlack, Imgproc.FILLED);
         assertEquals(0, Core.countNonZero(img));
     }
 
@@ -2188,11 +2188,11 @@ public class ImgprocTest extends OpenCVTestCase {
         Mat img = new Mat(20 + (int) labelSize.height, 20 + (int) labelSize.width, CvType.CV_8U, colorBlack);
         Point origin = new Point(10, 10);
 
-        Imgproc.putText(img, text, origin, Core.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite, 1, Imgproc.LINE_8, true);
+        Imgproc.putText(img, text, origin, Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite, 1, Imgproc.LINE_8, true);
 
         assertTrue(Core.countNonZero(img) > 0);
         // check that border is not corrupted
-        Imgproc.rectangle(img, new Point(10, 10), new Point(labelSize.width + 9, labelSize.height + 9), colorBlack, Core.FILLED);
+        Imgproc.rectangle(img, new Point(10, 10), new Point(labelSize.width + 9, labelSize.height + 9), colorBlack, Imgproc.FILLED);
         assertEquals(0, Core.countNonZero(img));
     }
 }
index 47ebeb8..5927b96 100644 (file)
@@ -141,7 +141,7 @@ public class CameraCalibrator {
         drawPoints(rgbaFrame);
 
         Imgproc.putText(rgbaFrame, "Captured: " + mCornersBuffer.size(), new Point(rgbaFrame.cols() / 3 * 2, rgbaFrame.rows() * 0.1),
-                Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
+                Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
     }
 
     public Mat getCameraMatrix() {
index 85a8504..311f4d5 100644 (file)
@@ -83,9 +83,9 @@ class ComparisonFrameRender extends FrameRender {
         Imgproc.fillPoly(comparisonFrame, border, new Scalar(255, 255, 255));
 
         Imgproc.putText(comparisonFrame, mResources.getString(R.string.original), new Point(mWidth * 0.1, mHeight * 0.1),
-                Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
+                Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
         Imgproc.putText(comparisonFrame, mResources.getString(R.string.undistorted), new Point(mWidth * 0.6, mHeight * 0.1),
-                Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
+                Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
 
         return comparisonFrame;
     }
index 31440e2..3b62cc1 100644 (file)
@@ -127,16 +127,16 @@ public class MainActivity extends AppCompatActivity implements CvCameraViewListe
                         new Scalar(0, 255, 0));
                 String label = classNames[classId] + ": " + confidence;
                 int[] baseLine = new int[1];
-                Size labelSize = Imgproc.getTextSize(label, Core.FONT_HERSHEY_SIMPLEX, 0.5, 1, baseLine);
+                Size labelSize = Imgproc.getTextSize(label, Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, 1, baseLine);
 
                 // Draw background for label.
                 Imgproc.rectangle(subFrame, new Point(xLeftBottom, yLeftBottom - labelSize.height),
                         new Point(xLeftBottom + labelSize.width, yLeftBottom + baseLine[0]),
-                        new Scalar(255, 255, 255), Core.FILLED);
+                        new Scalar(255, 255, 255), Imgproc.FILLED);
 
                 // Write class name and confidence.
                 Imgproc.putText(subFrame, label, new Point(xLeftBottom, yLeftBottom),
-                        Core.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(0, 0, 0));
+                        Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(0, 0, 0));
             }
         }
         return frame;
index c5b5f8d..d2e03c8 100644 (file)
@@ -145,7 +145,7 @@ class CalcBackProject1 {
         hist.get(0, 0, histData);
         for (int i = 0; i < bins; i++) {
             Imgproc.rectangle(histImg, new Point(i * binW, h),
-                    new Point((i + 1) * binW, h - Math.round(histData[i] * h / 255.0)), new Scalar(0, 0, 255), Core.FILLED);
+                    new Point((i + 1) * binW, h - Math.round(histData[i] * h / 255.0)), new Scalar(0, 0, 255), Imgproc.FILLED);
         }
         Image histImage = HighGui.toBufferedImage(histImg);
         histImgLabel.setIcon(new ImageIcon(histImage));
index b4d9630..8b5a833 100644 (file)
@@ -79,7 +79,7 @@ class SmoothingRun {
         dst = Mat.zeros(src.size(), src.type());
         Imgproc.putText(dst, caption,
                 new Point(src.cols() / 4, src.rows() / 2),
-                Core.FONT_HERSHEY_COMPLEX, 1, new Scalar(255, 255, 255));
+                Imgproc.FONT_HERSHEY_COMPLEX, 1, new Scalar(255, 255, 255));
 
         return displayDst(DELAY_CAPTION);
     }
index 5eec4f8..af6a1c8 100644 (file)
@@ -112,7 +112,7 @@ class FindContours {
         Mat drawing = Mat.zeros(cannyOutput.size(), CvType.CV_8UC3);
         for (int i = 0; i < contours.size(); i++) {
             Scalar color = new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256));
-            Imgproc.drawContours(drawing, contours, i, color, 2, Core.LINE_8, hierarchy, 0, new Point());
+            Imgproc.drawContours(drawing, contours, i, color, 2, Imgproc.LINE_8, hierarchy, 0, new Point());
         }
 
         imgContoursLabel.setIcon(new ImageIcon(HighGui.toBufferedImage(drawing)));
index 3be2e58..cb1888c 100644 (file)
@@ -115,7 +115,7 @@ class CornerSubPix {
         matCorners.get(0, 0, matCornersData);
         for (int i = 0; i < corners.rows(); i++) {
             Imgproc.circle(copy, new Point(cornersData[i * 2], cornersData[i * 2 + 1]), radius,
-                    new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Core.FILLED);
+                    new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Imgproc.FILLED);
             matCornersData[i * 2] = cornersData[i * 2];
             matCornersData[i * 2 + 1] = cornersData[i * 2 + 1];
         }
index 30450f8..f7743f5 100644 (file)
@@ -147,7 +147,7 @@ class CornerDetector {
                 if (McData[i * srcGray.cols() + j] > harrisMinVal
                         + (harrisMaxVal - harrisMinVal) * qualityLevelVal / MAX_QUALITY_LEVEL) {
                     Imgproc.circle(harrisCopy, new Point(j, i), 4,
-                            new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Core.FILLED);
+                            new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Imgproc.FILLED);
                 }
             }
         }
@@ -162,7 +162,7 @@ class CornerDetector {
                 if (shiTomasiData[i * srcGray.cols() + j] > shiTomasiMinVal
                         + (shiTomasiMaxVal - shiTomasiMinVal) * qualityLevelVal / MAX_QUALITY_LEVEL) {
                     Imgproc.circle(shiTomasiCopy, new Point(j, i), 4,
-                            new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Core.FILLED);
+                            new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Imgproc.FILLED);
                 }
             }
         }
index b5ee732..2033cd5 100644 (file)
@@ -109,7 +109,7 @@ class GoodFeaturesToTrack {
         int radius = 4;
         for (int i = 0; i < corners.rows(); i++) {
             Imgproc.circle(copy, new Point(cornersData[i * 2], cornersData[i * 2 + 1]), radius,
-                    new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Core.FILLED);
+                    new Scalar(rng.nextInt(256), rng.nextInt(256), rng.nextInt(256)), Imgproc.FILLED);
         }
 
         imgLabel.setIcon(new ImageIcon(HighGui.toBufferedImage(copy)));
index 5dfef53..8f07675 100644 (file)
@@ -23,16 +23,16 @@ class IntroductionToPCA {
         // Here we lengthen the arrow by a factor of scale
         q.x = (int) (p.x - scale * hypotenuse * Math.cos(angle));
         q.y = (int) (p.y - scale * hypotenuse * Math.sin(angle));
-        Imgproc.line(img, p, q, colour, 1, Core.LINE_AA, 0);
+        Imgproc.line(img, p, q, colour, 1, Imgproc.LINE_AA, 0);
 
         // create the arrow hooks
         p.x = (int) (q.x + 9 * Math.cos(angle + Math.PI / 4));
         p.y = (int) (q.y + 9 * Math.sin(angle + Math.PI / 4));
-        Imgproc.line(img, p, q, colour, 1, Core.LINE_AA, 0);
+        Imgproc.line(img, p, q, colour, 1, Imgproc.LINE_AA, 0);
 
         p.x = (int) (q.x + 9 * Math.cos(angle - Math.PI / 4));
         p.y = (int) (q.y + 9 * Math.sin(angle - Math.PI / 4));
-        Imgproc.line(img, p, q, colour, 1, Core.LINE_AA, 0);
+        Imgproc.line(img, p, q, colour, 1, Imgproc.LINE_AA, 0);
         //! [visualization1]
     }
 
index c44483f..dcff5ff 100644 (file)
@@ -71,7 +71,7 @@ public class IntroductionToSVMDemo {
         // Show the training data
         //! [show_data]
         int thickness = -1;
-        int lineType = Core.LINE_8;
+        int lineType = Imgproc.LINE_8;
         Imgproc.circle(image, new Point(501, 10), 5, new Scalar(0, 0, 0), thickness, lineType, 0);
         Imgproc.circle(image, new Point(255, 10), 5, new Scalar(255, 255, 255), thickness, lineType, 0);
         Imgproc.circle(image, new Point(501, 255), 5, new Scalar(255, 255, 255), thickness, lineType, 0);
index 798c1fc..b2b40d1 100644 (file)
@@ -148,7 +148,7 @@ public class NonLinearSVMsDemo {
         // ----------------------- 5. Show the training data--------------------------------------------
         //! [show_data]
         int thick = -1;
-        int lineType = Core.LINE_8;
+        int lineType = Imgproc.LINE_8;
         float px, py;
         // Class 1
         float[] trainDataData = new float[(int) (trainData.total() * trainData.channels())];