Merge pull request #3198 from mshabunin:java_test_fix

pull/3213/head
Andrey Pavlenko 11 years ago
commit 79f593a429
  1. 2
      cmake/OpenCVDetectPython.cmake
  2. 2
      modules/java/CMakeLists.txt
  3. 2
      modules/java/android_test/CMakeLists.txt
  4. 7
      modules/java/android_test/src/org/opencv/test/calib3d/Calib3dTest.java
  5. 21
      modules/java/android_test/src/org/opencv/test/core/CoreTest.java
  6. 1
      modules/java/android_test/src/org/opencv/test/features2d/BRIEFDescriptorExtractorTest.java
  7. 1
      modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
  8. 1
      modules/java/android_test/src/org/opencv/test/features2d/BruteForceHammingDescriptorMatcherTest.java
  9. 1
      modules/java/android_test/src/org/opencv/test/features2d/BruteForceHammingLUTDescriptorMatcherTest.java
  10. 1
      modules/java/android_test/src/org/opencv/test/features2d/BruteForceL1DescriptorMatcherTest.java
  11. 1
      modules/java/android_test/src/org/opencv/test/features2d/BruteForceSL2DescriptorMatcherTest.java
  12. 1
      modules/java/android_test/src/org/opencv/test/features2d/FASTFeatureDetectorTest.java
  13. 1
      modules/java/android_test/src/org/opencv/test/features2d/FlannBasedDescriptorMatcherTest.java
  14. 1
      modules/java/android_test/src/org/opencv/test/features2d/ORBDescriptorExtractorTest.java
  15. 1
      modules/java/android_test/src/org/opencv/test/features2d/SIFTDescriptorExtractorTest.java
  16. 11
      modules/java/android_test/src/org/opencv/test/features2d/STARFeatureDetectorTest.java
  17. 1
      modules/java/android_test/src/org/opencv/test/features2d/SURFDescriptorExtractorTest.java
  18. 1
      modules/java/android_test/src/org/opencv/test/features2d/SURFFeatureDetectorTest.java
  19. 40
      modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java
  20. 5
      modules/java/android_test/src/org/opencv/test/photo/PhotoTest.java
  21. 15
      modules/java/generator/gen_java.py
  22. 2
      modules/java/test/CMakeLists.txt
  23. 14
      modules/java/test/build.xml
  24. 2
      modules/java/test/src/org/opencv/test/OpenCVTestCase.java
  25. 1
      samples/android/15-puzzle/src/org/opencv/samples/puzzle15/Puzzle15Processor.java
  26. 1
      samples/android/camera-calibration/src/org/opencv/samples/cameracalibration/CameraCalibrator.java
  27. 2
      samples/android/color-blob-detection/src/org/opencv/samples/colorblobdetect/ColorBlobDetectionActivity.java
  28. 1
      samples/android/face-detection/src/org/opencv/samples/facedetect/FdActivity.java

@ -233,7 +233,7 @@ find_python(3.4 "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
PYTHON3_NUMPY_INCLUDE_DIRS PYTHON3_NUMPY_VERSION)
# Use Python 2 as default Python interpreter
if(PYTHON2LIBS_FOUND)
if(PYTHON2INTERP_FOUND)
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}")
endif()

@ -8,7 +8,7 @@ if(IOS OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND O
endif()
set(the_description "The java bindings")
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_imgcodecs opencv_videoio opencv_calib3d opencv_photo opencv_xfeatures2d)
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_imgcodecs opencv_videoio opencv_calib3d opencv_photo)
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp")
if(NOT ANDROID)

@ -11,6 +11,8 @@ set(opencv_test_java_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
# get project sources
file(GLOB_RECURSE opencv_test_java_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/res/*" "${CMAKE_CURRENT_SOURCE_DIR}/src/*")
ocv_list_filterout(opencv_test_java_files ".svn")
# opencv_ml is broken
ocv_list_filterout(opencv_test_java_files "/ml/")
# copy sources out from the build tree
set(opencv_test_java_file_deps "")

@ -11,6 +11,7 @@ import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.test.OpenCVTestCase;
import org.opencv.imgproc.Imgproc;
public class Calib3dTest extends OpenCVTestCase {
@ -162,7 +163,7 @@ public class Calib3dTest extends OpenCVTestCase {
public void testFilterSpecklesMatDoubleIntDouble() {
gray_16s_1024.copyTo(dst);
Point center = new Point(gray_16s_1024.rows() / 2., gray_16s_1024.cols() / 2.);
Core.circle(dst, center, 1, Scalar.all(4096));
Imgproc.circle(dst, center, 1, Scalar.all(4096));
assertMatNotEqual(gray_16s_1024, dst);
Calib3d.filterSpeckles(dst, 1024.0, 100, 0.);
@ -199,7 +200,7 @@ public class Calib3dTest extends OpenCVTestCase {
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++) {
Point pt = new Point(size * (2 * i + 1) / 10, size * (2 * j + 1) / 10);
Core.circle(img, pt, 10, new Scalar(0), -1);
Imgproc.circle(img, pt, 10, new Scalar(0), -1);
}
assertTrue(Calib3d.findCirclesGrid(img, new Size(5, 5), centers));
@ -224,7 +225,7 @@ public class Calib3dTest extends OpenCVTestCase {
for (int i = 0; i < 3; i++)
for (int j = 0; j < 5; j++) {
Point pt = new Point(offsetx + (2 * i + j % 2) * step, offsety + step * j);
Core.circle(img, pt, 10, new Scalar(0), -1);
Imgproc.circle(img, pt, 10, new Scalar(0), -1);
}
assertTrue(Calib3d.findCirclesGrid(img, new Size(3, 5), centers, Calib3d.CALIB_CB_CLUSTERING

@ -19,6 +19,7 @@ import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.core.TermCriteria;
import org.opencv.test.OpenCVTestCase;
import org.opencv.imgproc.Imgproc;
public class CoreTest extends OpenCVTestCase {
@ -455,12 +456,12 @@ public class CoreTest extends OpenCVTestCase {
// current implementation of fixed-point version of fillConvexPoly
// requires image to be at least 2-pixel wider in each direction than
// contour
Imgproc.fillConvexPoly(gray0, polyline1, colorWhite, Imgproc.line_8, 0);
Imgproc.fillConvexPoly(gray0, polyline1, colorWhite, Imgproc.LINE_8, 0);
assertTrue(0 < Core.countNonZero(gray0));
assertTrue(gray0.total() > Core.countNonZero(gray0));
Imgproc.fillConvexPoly(gray0, polyline2, colorBlack, Imgproc.line_8, 1);
Imgproc.fillConvexPoly(gray0, polyline2, colorBlack, Imgproc.LINE_8, 1);
assertEquals("see http://code.opencv.org/issues/1284", 0, Core.countNonZero(gray0));
}
@ -503,11 +504,11 @@ public class CoreTest extends OpenCVTestCase {
List<MatOfPoint> polylines2 = new ArrayList<MatOfPoint>();
polylines2.add(polyline2);
Imgproc.fillPoly(gray0, polylines1, new Scalar(1), Imgproc.line_8, 0, new Point(0, 0));
Imgproc.fillPoly(gray0, polylines1, new Scalar(1), Imgproc.LINE_8, 0, new Point(0, 0));
assertTrue(0 < Core.countNonZero(gray0));
Imgproc.fillPoly(gray0, polylines2, new Scalar(0), Imgproc.line_8, 0, new Point(1, 1));
Imgproc.fillPoly(gray0, polylines2, new Scalar(0), Imgproc.LINE_8, 0, new Point(1, 1));
assertEquals(0, Core.countNonZero(gray0));
}
@ -877,11 +878,11 @@ public class CoreTest extends OpenCVTestCase {
Point point1_4 = new Point(3 * 4, 4 * 4);
Point point2_4 = new Point(nPoints * 4, nPoints * 4);
Imgproc.line(gray0, point2, point1, colorWhite, 2, Imgproc.line_8, 0);
Imgproc.line(gray0, point2, point1, colorWhite, 2, Imgproc.LINE_8, 0);
assertFalse(0 == Core.countNonZero(gray0));
Imgproc.line(gray0, point2_4, point1_4, colorBlack, 2, Imgproc.line_8, 2);
Imgproc.line(gray0, point2_4, point1_4, colorBlack, 2, Imgproc.LINE_8, 2);
assertEquals(0, Core.countNonZero(gray0));
}
@ -1616,8 +1617,8 @@ public class CoreTest extends OpenCVTestCase {
Point topLeft = new Point(0, 0);
Scalar color = new Scalar(128);
Imgproc.rectangle(gray0, bottomRight, topLeft, color, 2, Imgproc.line_AA, 0);
Imgproc.rectangle(gray0, bottomRight, topLeft, colorBlack, 2, Imgproc.line_4, 0);
Imgproc.rectangle(gray0, bottomRight, topLeft, color, 2, Imgproc.LINE_AA, 0);
Imgproc.rectangle(gray0, bottomRight, topLeft, colorBlack, 2, Imgproc.LINE_4, 0);
assertTrue(0 != Core.countNonZero(gray0));
}
@ -1628,11 +1629,11 @@ public class CoreTest extends OpenCVTestCase {
Point topLeft = new Point(0, 0);
Scalar color = new Scalar(128);
Imgproc.rectangle(gray0, bottomRight1, topLeft, color, 2, Imgproc.line_8, 1);
Imgproc.rectangle(gray0, bottomRight1, topLeft, color, 2, Imgproc.LINE_8, 1);
assertTrue(0 != Core.countNonZero(gray0));
Imgproc.rectangle(gray0, bottomRight2, topLeft, colorBlack, 2, Imgproc.line_8, 0);
Imgproc.rectangle(gray0, bottomRight2, topLeft, colorBlack, 2, Imgproc.LINE_8, 0);
assertEquals(0, Core.countNonZero(gray0));
}

@ -10,6 +10,7 @@ import org.opencv.features2d.DescriptorExtractor;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {

@ -18,6 +18,7 @@ import org.opencv.features2d.FeatureDetector;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {

@ -17,6 +17,7 @@ import org.opencv.features2d.DescriptorMatcher;
import org.opencv.features2d.FeatureDetector;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {

@ -16,6 +16,7 @@ import org.opencv.features2d.DescriptorMatcher;
import org.opencv.features2d.FeatureDetector;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {

@ -17,6 +17,7 @@ import org.opencv.features2d.FeatureDetector;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {

@ -17,6 +17,7 @@ import org.opencv.features2d.FeatureDetector;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {

@ -12,6 +12,7 @@ import org.opencv.features2d.FeatureDetector;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class FASTFeatureDetectorTest extends OpenCVTestCase {

@ -18,6 +18,7 @@ import org.opencv.features2d.FeatureDetector;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {

@ -10,6 +10,7 @@ import org.opencv.features2d.DescriptorExtractor;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class ORBDescriptorExtractorTest extends OpenCVTestCase {

@ -10,6 +10,7 @@ import org.opencv.features2d.DescriptorExtractor;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class SIFTDescriptorExtractorTest extends OpenCVTestCase {

@ -12,6 +12,7 @@ import org.opencv.features2d.FeatureDetector;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class STARFeatureDetectorTest extends OpenCVTestCase {
@ -33,11 +34,11 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
int offset = 40;
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.circle(img, new Point(center - offset, center), radius, color, -1);
Core.circle(img, new Point(center + offset, center), radius, color, -1);
Core.circle(img, new Point(center, center - offset), radius, color, -1);
Core.circle(img, new Point(center, center + offset), radius, color, -1);
Core.circle(img, new Point(center, center), radius, color, -1);
Imgproc.circle(img, new Point(center - offset, center), radius, color, -1);
Imgproc.circle(img, new Point(center + offset, center), radius, color, -1);
Imgproc.circle(img, new Point(center, center - offset), radius, color, -1);
Imgproc.circle(img, new Point(center, center + offset), radius, color, -1);
Imgproc.circle(img, new Point(center, center), radius, color, -1);
return img;
}

@ -10,6 +10,7 @@ import org.opencv.features2d.DescriptorExtractor;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class SURFDescriptorExtractorTest extends OpenCVTestCase {

@ -16,6 +16,7 @@ import org.opencv.features2d.FeatureDetector;
import org.opencv.core.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
import org.opencv.imgproc.Imgproc;
public class SURFFeatureDetectorTest extends OpenCVTestCase {

@ -647,7 +647,7 @@ public class ImgprocTest extends OpenCVTestCase {
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Imgproc.findContours(gray0, contours, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
Core.drawContours(gray0, contours, -1, new Scalar(0));
Imgproc.drawContours(gray0, contours, -1, new Scalar(0));
assertEquals(0, Core.countNonZero(gray0));
}
@ -657,7 +657,7 @@ public class ImgprocTest extends OpenCVTestCase {
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Imgproc.findContours(gray0, contours, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
Core.drawContours(gray0, contours, -1, new Scalar(0), Core.FILLED);
Imgproc.drawContours(gray0, contours, -1, new Scalar(0), Core.FILLED);
assertEquals(0, Core.countNonZero(gray0));
}
@ -758,7 +758,7 @@ public class ImgprocTest extends OpenCVTestCase {
assertEquals(contours.size(), 0);
assertEquals(contours.size(), hierarchy.total());
Imgproc.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Imgproc.line_AA, 0);
Imgproc.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Imgproc.LINE_AA, 0);
Imgproc.rectangle(img, new Point(30, 35), new Point(40, 45), new Scalar(200));
Imgproc.findContours(img, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
@ -775,7 +775,7 @@ public class ImgprocTest extends OpenCVTestCase {
List<MatOfPoint> contours2 = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Imgproc.line_AA, 0);
Imgproc.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Imgproc.LINE_AA, 0);
Imgproc.rectangle(img, new Point(30, 35), new Point(40, 45), new Scalar(200));
Imgproc.findContours(img, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
@ -817,24 +817,24 @@ public class ImgprocTest extends OpenCVTestCase {
public void testFloodFillMatMatPointScalar() {
Mat mask = new Mat(matSize + 2, matSize + 2, CvType.CV_8U, new Scalar(0));
Mat img = gray0;
Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(2));
Imgproc.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(2));
int retval = Imgproc.floodFill(img, mask, new Point(matSize / 2, matSize / 2), new Scalar(1));
assertEquals(Core.countNonZero(img), retval);
Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(0));
Imgproc.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(0));
assertEquals(retval + 4 * (matSize + 1), Core.countNonZero(mask));
assertMatEqual(mask.submat(1, matSize + 1, 1, matSize + 1), img);
}
public void testFloodFillMatMatPointScalar_WithoutMask() {
Mat img = gray0;
Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(2));
Imgproc.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(2));
// TODO: ideally we should pass null instead of "new Mat()"
int retval = Imgproc.floodFill(img, new Mat(), new Point(matSize / 2, matSize / 2), new Scalar(1));
Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(0));
Imgproc.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(0));
assertEquals(Core.countNonZero(img), retval);
}
@ -1063,7 +1063,7 @@ public class ImgprocTest extends OpenCVTestCase {
Point center = new Point(img.cols() / 2, img.rows() / 2);
int radius = Math.min(img.cols() / 4, img.rows() / 4);
Core.circle(img, center, radius, colorBlack, 3);
Imgproc.circle(img, center, radius, colorBlack, 3);
Imgproc.HoughCircles(img, circles, Imgproc.CV_HOUGH_GRADIENT, 2, img.rows() / 4);
@ -1973,7 +1973,7 @@ public class ImgprocTest extends OpenCVTestCase {
Scalar color128 = new Scalar(128);
Scalar color0 = new Scalar(0);
Imgproc.circle(gray0, center2, radius * 2, color128, 2, Imgproc.line_4, 1/*
Imgproc.circle(gray0, center2, radius * 2, color128, 2, Imgproc.LINE_4, 1/*
* Number
* of
* fractional
@ -1981,7 +1981,7 @@ public class ImgprocTest extends OpenCVTestCase {
*/);
assertFalse(0 == Core.countNonZero(gray0));
Imgproc.circle(gray0, center, radius, color0, 2, Imgproc.line_4, 0);
Imgproc.circle(gray0, center, radius, color0, 2, Imgproc.LINE_4, 0);
assertTrue(0 == Core.countNonZero(gray0));
}
@ -1991,7 +1991,7 @@ public class ImgprocTest extends OpenCVTestCase {
Point pt1 = new Point(5.0, 15.0);
Point pt2 = new Point(25.0, 15.0);
assertTrue(Core.clipLine(r, pt1, pt2));
assertTrue(Imgproc.clipLine(r, pt1, pt2));
Point pt1Clipped = new Point(10.0, 15.0);
Point pt2Clipped = new Point(19.0, 15.0);
@ -2003,7 +2003,7 @@ public class ImgprocTest extends OpenCVTestCase {
pt1Clipped = new Point(5.0, 5.0);
pt2Clipped = new Point(25.0, 5.0);
assertFalse(Core.clipLine(r, pt1, pt2));
assertFalse(Imgproc.clipLine(r, pt1, pt2));
assertEquals(pt1Clipped, pt1);
assertEquals(pt2Clipped, pt2);
@ -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, Core.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, Core.FILLED, Imgproc.LINE_4, 1);
assertEquals(0, Core.countNonZero(gray0));
}
@ -2107,8 +2107,8 @@ public class ImgprocTest extends OpenCVTestCase {
Size size = new Size(2, matSize * 2 / 3);
RotatedRect box = new RotatedRect(center, size, 20);
Imgproc.ellipse(gray0, box, new Scalar(9), 1, Imgproc.line_AA);
Imgproc.ellipse(gray0, box, new Scalar(0), 1, Imgproc.line_4);
Imgproc.ellipse(gray0, box, new Scalar(9), 1, Imgproc.LINE_AA);
Imgproc.ellipse(gray0, box, new Scalar(0), 1, Imgproc.LINE_4);
assertTrue(0 < Core.countNonZero(gray0));
}
@ -2144,11 +2144,11 @@ public class ImgprocTest extends OpenCVTestCase {
List<MatOfPoint> polyline2 = new ArrayList<MatOfPoint>();
polyline2.add(new MatOfPoint(new Point(2, 2), new Point(14, 2), new Point(14, 12), new Point(2, 12)));
Imgproc.polylines(img, polyline1, true, new Scalar(100), 2, Imgproc.line_8, 0);
Imgproc.polylines(img, polyline1, true, new Scalar(100), 2, Imgproc.LINE_8, 0);
assertTrue(Core.countNonZero(img) > 0);
Imgproc.polylines(img, polyline2, true, new Scalar(0), 2, Imgproc.line_8, 1);
Imgproc.polylines(img, polyline2, true, new Scalar(0), 2, Imgproc.LINE_8, 1);
assertEquals(0, Core.countNonZero(img));
}
@ -2188,7 +2188,7 @@ 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, Core.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite, 1, Imgproc.LINE_8, true);
assertTrue(Core.countNonZero(img) > 0);
// check that border is not corrupted

@ -5,13 +5,14 @@ import org.opencv.core.CvType;
import org.opencv.core.Point;
import org.opencv.photo.Photo;
import org.opencv.test.OpenCVTestCase;
import org.opencv.imgproc.Imgproc;
public class PhotoTest extends OpenCVTestCase {
public void testInpaint() {
Point p = new Point(matSize / 2, matSize / 2);
Core.circle(gray255, p, 2, colorBlack, Core.FILLED);
Core.circle(gray0, p, 2, colorWhite, Core.FILLED);
Imgproc.circle(gray255, p, 2, colorBlack, Core.FILLED);
Imgproc.circle(gray0, p, 2, colorWhite, Core.FILLED);
Photo.inpaint(gray255, gray0, dst, 3, Photo.INPAINT_TELEA);

@ -127,7 +127,6 @@ missing_consts = \
(
('SVD_MODIFY_A', 1), ('SVD_NO_UV', 2), ('SVD_FULL_UV', 4),
('FILLED', -1),
('LINE_AA', 16), ('LINE_8', 8), ('LINE_4', 4),
('REDUCE_SUM', 0), ('REDUCE_AVG', 1), ('REDUCE_MAX', 2), ('REDUCE_MIN', 3),
) #public
}, # Core
@ -142,7 +141,11 @@ missing_consts = \
('IPL_BORDER_WRAP', 3 ),
('IPL_BORDER_REFLECT_101', 4 ),
('IPL_BORDER_TRANSPARENT', 5 ),
) # private
), # private
'public' :
(
('LINE_AA', 16), ('LINE_8', 8), ('LINE_4', 4),
) #public
}, # Imgproc
"Calib3d":
@ -445,9 +448,9 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
'cpp_code' :
"""
// C++: Size getTextSize(const String& text, int fontFace, double fontScale, int thickness, int* baseLine);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize (JNIEnv*, jclass, jstring, jint, jdouble, jint, jintArray);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_imgproc_Imgproc_n_1getTextSize (JNIEnv*, jclass, jstring, jint, jdouble, jint, jintArray);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_imgproc_Imgproc_n_1getTextSize
(JNIEnv* env, jclass, jstring text, jint fontFace, jdouble fontScale, jint thickness, jintArray baseLine)
{
try {
@ -484,13 +487,13 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
return result;
} catch(const cv::Exception& e) {
LOGD("Core::n_1getTextSize() catched cv::Exception: %s", e.what());
LOGD("Imgproc::n_1getTextSize() catched cv::Exception: %s", e.what());
jclass je = env->FindClass("org/opencv/core/CvException");
if(!je) je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, e.what());
return NULL;
} catch (...) {
LOGD("Core::n_1getTextSize() catched unknown exception (...)");
LOGD("Imgproc::n_1getTextSize() catched unknown exception (...)");
jclass je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, "Unknown exception in JNI code {core::getTextSize()}");
return NULL;

@ -19,6 +19,8 @@ file(GLOB_RECURSE opencv_test_java_files RELATIVE "${android_source_dir}" "${and
ocv_list_filterout(opencv_test_java_files "OpenCVTest(Case|Runner).java")
# These files aren't for desktop Java.
ocv_list_filterout(opencv_test_java_files "/android/")
# opencv_ml is broken
ocv_list_filterout(opencv_test_java_files "/ml/")
# These are files updated for pure Java.
file(GLOB_RECURSE modified_files RELATIVE "${java_source_dir}" "${java_source_dir}/src/*")

@ -1,5 +1,7 @@
<project>
<property file="ant-${opencv.build.type}.properties"/>
<property name="test.dir" value="testResults"/>
<property name="build.dir" value="build"/>
<path id="master-classpath">
<fileset dir="lib">
@ -12,7 +14,7 @@
<target name="clean">
<delete dir="build"/>
<delete dir="testResults"/>
<delete dir="${test.dir}"/>
</target>
<target name="compile">
@ -34,7 +36,7 @@
</target>
<target name="test">
<mkdir dir="testResults"/>
<mkdir dir="${test.dir}"/>
<junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="false" logfailedtests="true" maxmemory="256m">
<sysproperty key="java.library.path" path="${opencv.lib.path}"/>
<env key="PATH" path="${opencv.lib.path}"/>
@ -45,12 +47,18 @@
<formatter type="xml"/>
<batchtest fork="yes" todir="testResults">
<batchtest fork="yes" todir="${test.dir}">
<zipfileset src="build/jar/opencv-test.jar" includes="**/*.class" excludes="**/OpenCVTest*">
<exclude name="**/*$*.class"/>
</zipfileset>
</batchtest>
</junit>
<junitreport todir="${test.dir}">
<fileset dir="${test.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes" todir="${test.dir}"/>
</junitreport>
</target>
<target name="build">

@ -116,7 +116,7 @@ public class OpenCVTestCase extends TestCase {
return;
}
OpenCVTestRunner.LENA_PATH = pwd + "res/drawable/lena.jpg";
OpenCVTestRunner.LENA_PATH = pwd + "res/drawable/lena.png";
OpenCVTestRunner.CHESS_PATH = pwd + "res/drawable/chessboard.jpg";
OpenCVTestRunner.LBPCASCADE_FRONTALFACE_PATH = pwd + "res/raw/lbpcascade_frontalface.xml";

@ -6,6 +6,7 @@ import org.opencv.core.Mat;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.core.Point;
import org.opencv.imgproc.Imgproc;
import android.util.Log;

@ -13,6 +13,7 @@ import org.opencv.core.MatOfPoint3f;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;
import android.util.Log;

@ -174,7 +174,7 @@ public class ColorBlobDetectionActivity extends Activity implements OnTouchListe
mDetector.process(mRgba);
List<MatOfPoint> contours = mDetector.getContours();
Log.e(TAG, "Contours count: " + contours.size());
Core.drawContours(mRgba, contours, -1, CONTOUR_COLOR);
Imgproc.drawContours(mRgba, contours, -1, CONTOUR_COLOR);
Mat colorLabel = mRgba.submat(4, 68, 4, 68);
colorLabel.setTo(mBlobColorRgba);

@ -18,6 +18,7 @@ import org.opencv.core.Size;
import org.opencv.android.CameraBridgeViewBase;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2;
import org.opencv.objdetect.CascadeClassifier;
import org.opencv.imgproc.Imgproc;
import android.app.Activity;
import android.content.Context;

Loading…
Cancel
Save