vendor: OpenCV 5.0.0 snapshot at 755e50675d97db9b7d449d8bd6b09888646f6c6e
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"missing_consts": {
|
||||
"Ximgproc": {
|
||||
"public": [
|
||||
["RO_STRICT", 0],
|
||||
["RO_IGNORE_BORDERS", 1]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.opencv.test.ximgproc;
|
||||
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
import org.opencv.ximgproc.Ximgproc;
|
||||
|
||||
public class XimgprocTest extends OpenCVTestCase {
|
||||
|
||||
public void testHoughPoint2Line() {
|
||||
Mat src = new Mat(80, 80, CvType.CV_8UC1, new org.opencv.core.Scalar(0));
|
||||
Point houghPoint = new Point(40, 40);
|
||||
|
||||
int[] result = Ximgproc.HoughPoint2Line(houghPoint, src, Ximgproc.ARO_315_135, Ximgproc.HDO_DESKEW, Ximgproc.RO_IGNORE_BORDERS);
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(4, result.length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"whitelist":
|
||||
{
|
||||
"": ["createEdgeDrawing"],
|
||||
"ximgproc_EdgeDrawing": ["setParams", "detectEdges", "getEdgeImage"],
|
||||
"ximgproc_EdgeDrawing_Params": ["Params", "PFmode"]
|
||||
},
|
||||
"namespace_prefix_override":
|
||||
{
|
||||
"ximgproc": ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"AdditionalImports" : {
|
||||
"*" : [ "\"ximgproc.hpp\"" ]
|
||||
},
|
||||
"missing_consts" : {
|
||||
"Ximgproc" : {
|
||||
"private" : [],
|
||||
"public" : [
|
||||
["RO_IGNORE_BORDERS", 1], ["RO_STRICT", 0]
|
||||
]
|
||||
}
|
||||
},
|
||||
"func_arg_fix" : {
|
||||
"Ximgproc" : {
|
||||
"niBlackThreshold" : { "binarizationMethod" : {"ctype" : "LocalBinarizationMethods"} },
|
||||
"HoughPoint2Line" : { "angleRange" : {"ctype" : "AngleRangeOption"},
|
||||
"makeSkew" : {"ctype" : "HoughDeskewOption"} },
|
||||
"weightedMedianFilter" : { "weightType" : {"ctype" : "WMFWeightType"} },
|
||||
"createDTFilter" : { "mode" : {"ctype" : "EdgeAwareFiltersList"} },
|
||||
"dtFilter" : { "mode" : {"ctype" : "EdgeAwareFiltersList"} },
|
||||
"thinning" : { "thinningType" : {"ctype" : "ThinningTypes"} },
|
||||
"FastHoughTransform" : { "angleRange" : {"ctype" : "AngleRangeOption"},
|
||||
"makeSkew" : {"ctype" : "HoughDeskewOption"},
|
||||
"op" : {"ctype" : "HoughOp"} },
|
||||
"createSuperpixelSLIC" : { "algorithm" : {"ctype" : "SLICType"} }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#ifdef HAVE_OPENCV_XIMGPROC
|
||||
typedef cv::ximgproc::EdgeDrawing::Params EdgeDrawing_Params;
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
from tests_common import NewOpenCVTests
|
||||
|
||||
class disparity_test(NewOpenCVTests):
|
||||
def test_disp(self):
|
||||
# readGT
|
||||
ret,GT = cv.ximgproc.readGT(self.find_file("cv/disparityfilter/GT.png"))
|
||||
self.assertEqual(ret, 0) # returns 0 on success!
|
||||
self.assertFalse(np.shape(GT) == ())
|
||||
|
||||
# computeMSE
|
||||
left = cv.imread(self.find_file("cv/disparityfilter/disparity_left_raw.png"), cv.IMREAD_UNCHANGED)
|
||||
self.assertFalse(np.shape(left) == ())
|
||||
left = np.asarray(left, dtype=np.int16)
|
||||
mse = cv.ximgproc.computeMSE(GT, left, (0, 0, GT.shape[1], GT.shape[0]))
|
||||
|
||||
# computeBadPixelPercent
|
||||
bad = cv.ximgproc.computeBadPixelPercent(GT, left, (0, 0, GT.shape[1], GT.shape[0]), 24)
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python
|
||||
import numpy as np
|
||||
import cv2 as cv
|
||||
|
||||
from tests_common import NewOpenCVTests
|
||||
|
||||
class Interpolator_test(NewOpenCVTests):
|
||||
def test_edgeaware_interpolator(self):
|
||||
# readGT
|
||||
MAX_DIF = 1.0
|
||||
MAX_MEAN_DIF = 1.0 / 256.0
|
||||
|
||||
src = cv.imread(self.find_file("cv/optflow/RubberWhale1.png"), cv.IMREAD_COLOR)
|
||||
self.assertFalse(src is None)
|
||||
|
||||
ref_flow = cv.readOpticalFlow(self.find_file("cv/sparse_match_interpolator/RubberWhale_reference_result.flo"))
|
||||
self.assertFalse(ref_flow is None)
|
||||
|
||||
matches = np.genfromtxt(self.find_file("cv/sparse_match_interpolator/RubberWhale_sparse_matches.txt")).astype(np.float32)
|
||||
from_points = matches[:,0:2]
|
||||
to_points = matches[:,2:4]
|
||||
interpolator = cv.ximgproc.createEdgeAwareInterpolator()
|
||||
interpolator.setK(128)
|
||||
interpolator.setSigma(0.05)
|
||||
interpolator.setUsePostProcessing(True)
|
||||
interpolator.setFGSLambda(500.0)
|
||||
interpolator.setFGSSigma(1.5)
|
||||
|
||||
dense_flow = interpolator.interpolate(src, from_points, src, to_points)
|
||||
|
||||
self.assertTrue(cv.norm(dense_flow, ref_flow, cv.NORM_INF) <= MAX_DIF)
|
||||
self.assertTrue(cv.norm(dense_flow, ref_flow, cv.NORM_L1) <= (MAX_MEAN_DIF * dense_flow.shape[0] * dense_flow.shape[1]))
|
||||
|
||||
def test_ric_interpolator(self):
|
||||
# readGT
|
||||
MAX_DIF = 6.0
|
||||
MAX_MEAN_DIF = 60.0 / 256.0
|
||||
|
||||
src0 = cv.imread(self.find_file("cv/optflow/RubberWhale1.png"), cv.IMREAD_COLOR)
|
||||
self.assertFalse(src0 is None)
|
||||
|
||||
src1 = cv.imread(self.find_file("cv/optflow/RubberWhale2.png"), cv.IMREAD_COLOR)
|
||||
self.assertFalse(src1 is None)
|
||||
|
||||
ref_flow = cv.readOpticalFlow(self.find_file("cv/sparse_match_interpolator/RubberWhale_reference_result.flo"))
|
||||
self.assertFalse(ref_flow is None)
|
||||
|
||||
matches = np.genfromtxt(self.find_file("cv/sparse_match_interpolator/RubberWhale_sparse_matches.txt")).astype(np.float32)
|
||||
from_points = matches[:,0:2]
|
||||
to_points = matches[:,2:4]
|
||||
|
||||
interpolator = cv.ximgproc.createRICInterpolator()
|
||||
interpolator.setK(32)
|
||||
interpolator.setSuperpixelSize(15)
|
||||
interpolator.setSuperpixelNNCnt(150)
|
||||
interpolator.setSuperpixelRuler(15.0)
|
||||
interpolator.setSuperpixelMode(cv.ximgproc.SLIC)
|
||||
interpolator.setAlpha(0.7)
|
||||
interpolator.setModelIter(4)
|
||||
interpolator.setRefineModels(True)
|
||||
interpolator.setMaxFlow(250)
|
||||
interpolator.setUseVariationalRefinement(True)
|
||||
interpolator.setUseGlobalSmootherFilter(True)
|
||||
interpolator.setFGSLambda(500.0)
|
||||
interpolator.setFGSSigma(1.5)
|
||||
dense_flow = interpolator.interpolate(src0, from_points, src1, to_points)
|
||||
self.assertTrue(cv.norm(dense_flow, ref_flow, cv.NORM_INF) <= MAX_DIF)
|
||||
self.assertTrue(cv.norm(dense_flow, ref_flow, cv.NORM_L1) <= (MAX_MEAN_DIF * dense_flow.shape[0] * dense_flow.shape[1]))
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
Reference in New Issue
Block a user