Commit f13e54dd authored by Andrey Pavlenko's avatar Andrey Pavlenko

#921 less signatures for func-s with default arg val-s (aka smart overloads);

moving inpaintTest() to 'photo';
hiding 'Point*' arg in Java signature of Core.checkRange().
parent 5c4b9847
......@@ -360,10 +360,10 @@ public class OpenCVTestCase extends TestCase {
if (isEqualityMeasured)
assertTrue("Max difference between expected and actiual Mats is bigger than " + eps,
Core.checkRange(diff, true, new Point(), 0.0, eps));
Core.checkRange(diff, true, 0.0, eps));
else
assertFalse("Max difference between expected and actiual Mats is less than " + eps,
Core.checkRange(diff, true, new Point(), 0.0, eps));
Core.checkRange(diff, true, 0.0, eps));
}
protected static String readFile(String path) {
......
......@@ -124,7 +124,7 @@ public class Features2dTest extends OpenCVTestCase {
points2.add(queryKeypoints.get(match.queryIdx).pt);
}
Mat hmg = Calib3d.findHomography(points1, points2, Calib3d.RANSAC);
Mat hmg = Calib3d.findHomography(points1, points2, Calib3d.RANSAC, 3);
assertMatEqual(Mat.eye(3, 3, CvType.CV_64F), hmg, EPS);
......
......@@ -40,7 +40,7 @@ public class CascadeClassifierTest extends OpenCVTestCase {
Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY);
// TODO: doesn't detect with 1.1 scale
cc.detectMultiScale(greyLena, faces, 1.09, 3, Objdetect.CASCADE_SCALE_IMAGE, new Size(30, 30));
cc.detectMultiScale(greyLena, faces, 1.09, 3, Objdetect.CASCADE_SCALE_IMAGE, new Size(30, 30), new Size());
assertEquals(1, faces.size());
}
......
package org.opencv.test.photo;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Point;
import org.opencv.photo.Photo;
import org.opencv.test.OpenCVTestCase;
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);
Photo.inpaint(gray255, gray0, dst, 3, Photo.INPAINT_TELEA);
assertMatEqual(getMat(CvType.CV_8U, 255), dst);
}
}
......@@ -71,25 +71,10 @@ public class VideoTest extends OpenCVTestCase {
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSize() {
Size sz = new Size(3, 3);
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz);
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz, 3);
assertEquals(0, Core.countNonZero(Converters.vector_uchar_to_Mat(status)));
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeInt() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteria() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDouble() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleInt() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleIntDouble() {
fail("Not yet implemented");
......
......@@ -463,6 +463,8 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
""",
}, # getTextSize
## "checkRange" : #TBD
## {'j_code' : '/* TBD: checkRange() */', 'jn_code' : '', 'cpp_code' : '' },
"checkHardwareSupport" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' },
"setUseOptimized" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' },
......@@ -514,7 +516,9 @@ func_arg_fix = {
'getAffineTransform' : { 'src' : 'vector_Point2f', 'dst' : 'vector_Point2f', },
'hconcat' : { 'src' : 'vector_Mat', },
'vconcat' : { 'src' : 'vector_Mat', },
'undistortPoints' : { 'src' : 'vector_Point2d', 'dst' : 'vector_Point2d' }
'undistortPoints' : { 'src' : 'vector_Point2d', 'dst' : 'vector_Point2d' },
'checkRange' : {'pos' : '*'},
#'meanStdDev' : {'mean' : 'Scalar', 'stddev' : 'Scalar'},
}, # '', i.e. no class
} # func_arg_fix
......@@ -913,7 +917,7 @@ extern "C" {
else:
decl_args = []
for a in fi.args:
s = a.ctype
s = a.ctype or ' _hidden_ '
if a.pointer:
s += "*"
elif a.out:
......@@ -974,6 +978,8 @@ extern "C" {
jni_args.append( ArgInfo([ "__int64", "self", "", [], "" ]) )
self.get_imports(fi.classname, fi.ctype)
for a in args:
if not a.ctype: # hidden
continue
self.get_imports(fi.classname, a.ctype)
if "vector" in a.ctype: # pass as Mat
jn_args.append ( ArgInfo([ "__int64", "%s_mat.nativeObj" % a.name, "", [], "" ]) )
......@@ -1083,6 +1089,8 @@ extern "C" {
j_args = []
for a in args:
if not a.ctype: #hidden
continue
jt = type_dict[a.ctype]["j_type"]
if a.out and a.ctype in ('bool', 'int', 'long', 'float', 'double'):
jt += '[]'
......@@ -1169,11 +1177,13 @@ extern "C" {
jni_name = "&%(n)s"
else:
jni_name = "%(n)s"
if not a.ctype: # hidden
jni_name = a.defval
cvargs.append( type_dict[a.ctype].get("jni_name", jni_name) % {"n" : a.name})
if "vector" not in a.ctype :
if ("I" in a.out or not a.out or a.ctype in self.classes) and "jni_var" in type_dict[a.ctype]: # complex type
c_prologue.append(type_dict[a.ctype]["jni_var"] % {"n" : a.name} + ";")
if a.out and "I" not in a.out and a.ctype not in self.classes:
if a.out and "I" not in a.out and a.ctype not in self.classes and a.ctype:
c_prologue.append("%s %s;" % (a.ctype, a.name))
rtype = type_dict[fi.ctype].get("jni_type", "jdoubleArray")
......@@ -1217,16 +1227,19 @@ JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname
epilogue = " ".join(c_epilogue), \
ret = ret, \
cvname = cvname, \
cvargs = ", ".join([a for a in cvargs]), \
cvargs = ", ".join(cvargs), \
default = default, \
retval = retval, \
) )
# processing args with default values
if args and args[-1].defval:
a = args.pop()
else:
if not args or not args[-1].defval:
break
while args and args[-1].defval:
# 'smart' overloads filtering
a = args.pop()
if a.name in ('mask', 'dtype', 'ddepth', 'lineType', 'borderType', 'borderMode', 'criteria'):
break
......
import os, sys, re, string, glob
allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts"]
allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts", "photo"]
verbose = False
show_warnings = True
show_errors = True
......
import os, sys, re, string, glob
allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts"]
allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts", "photo"]
verbose = False
show_warnings = True
show_errors = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment