Fixed java tests build

- disabled xfeature2d dependency for java wrappers
- fixed java wrappers build after cmake rerun
- disabled opencv_ml tests temporarily
- fixed Imgproc usage in java tests
This commit is contained in:
Maksim Shabunin 2014-09-08 17:35:55 +04:00
parent 43714b9d03
commit b3bae170ed
20 changed files with 64 additions and 43 deletions

View File

@ -228,7 +228,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()

View File

@ -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

View File

@ -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));
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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;
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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);

View File

@ -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":

View File

@ -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/*")