Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
|
||||
//warning number '5033' not a valid compiler warning in vc12
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1800)
|
||||
// eliminating duplicated round() declaration
|
||||
#define HAVE_ROUND 1
|
||||
#pragma warning(push)
|
||||
@@ -6,7 +7,7 @@
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <Python.h>
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1800)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,5 +46,44 @@ class Bindings(NewOpenCVTests):
|
||||
pass
|
||||
|
||||
|
||||
class Arguments(NewOpenCVTests):
|
||||
|
||||
def test_InputArray(self):
|
||||
res1 = cv.utils.dumpInputArray(None)
|
||||
#self.assertEqual(res1, "InputArray: noArray()") # not supported
|
||||
self.assertEqual(res1, "InputArray: empty()=true kind=0x00010000 flags=0x01010000 total(-1)=0 dims(-1)=0 size(-1)=0x0 type(-1)=CV_8UC1")
|
||||
res2_1 = cv.utils.dumpInputArray((1, 2))
|
||||
self.assertEqual(res2_1, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=2 dims(-1)=2 size(-1)=1x2 type(-1)=CV_64FC1")
|
||||
res2_2 = cv.utils.dumpInputArray(1.5) # Scalar(1.5, 1.5, 1.5, 1.5)
|
||||
self.assertEqual(res2_2, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=4 dims(-1)=2 size(-1)=1x4 type(-1)=CV_64FC1")
|
||||
a = np.array([[1,2],[3,4],[5,6]])
|
||||
res3 = cv.utils.dumpInputArray(a) # 32SC1
|
||||
self.assertEqual(res3, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=6 dims(-1)=2 size(-1)=2x3 type(-1)=CV_32SC1")
|
||||
a = np.array([[[1,2],[3,4],[5,6]]], dtype='f')
|
||||
res4 = cv.utils.dumpInputArray(a) # 32FC2
|
||||
self.assertEqual(res4, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=3 dims(-1)=2 size(-1)=3x1 type(-1)=CV_32FC2")
|
||||
a = np.array([[[1,2]],[[3,4]],[[5,6]]], dtype=float)
|
||||
res5 = cv.utils.dumpInputArray(a) # 64FC2
|
||||
self.assertEqual(res5, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=3 dims(-1)=2 size(-1)=1x3 type(-1)=CV_64FC2")
|
||||
|
||||
|
||||
def test_InputArrayOfArrays(self):
|
||||
res1 = cv.utils.dumpInputArrayOfArrays(None)
|
||||
#self.assertEqual(res1, "InputArray: noArray()") # not supported
|
||||
self.assertEqual(res1, "InputArrayOfArrays: empty()=true kind=0x00050000 flags=0x01050000 total(-1)=0 dims(-1)=1 size(-1)=0x0")
|
||||
res2_1 = cv.utils.dumpInputArrayOfArrays((1, 2)) # { Scalar:all(1), Scalar::all(2) }
|
||||
self.assertEqual(res2_1, "InputArrayOfArrays: empty()=false kind=0x00050000 flags=0x01050000 total(-1)=2 dims(-1)=1 size(-1)=2x1 type(0)=CV_64FC1 dims(0)=2 size(0)=1x4 type(0)=CV_64FC1")
|
||||
res2_2 = cv.utils.dumpInputArrayOfArrays([1.5])
|
||||
self.assertEqual(res2_2, "InputArrayOfArrays: empty()=false kind=0x00050000 flags=0x01050000 total(-1)=1 dims(-1)=1 size(-1)=1x1 type(0)=CV_64FC1 dims(0)=2 size(0)=1x4 type(0)=CV_64FC1")
|
||||
a = np.array([[1,2],[3,4],[5,6]])
|
||||
b = np.array([[1,2,3],[4,5,6],[7,8,9]])
|
||||
res3 = cv.utils.dumpInputArrayOfArrays([a, b])
|
||||
self.assertEqual(res3, "InputArrayOfArrays: empty()=false kind=0x00050000 flags=0x01050000 total(-1)=2 dims(-1)=1 size(-1)=2x1 type(0)=CV_32SC1 dims(0)=2 size(0)=2x3 type(0)=CV_32SC1")
|
||||
c = np.array([[[1,2],[3,4],[5,6]]], dtype='f')
|
||||
res4 = cv.utils.dumpInputArrayOfArrays([c, a, b])
|
||||
self.assertEqual(res4, "InputArrayOfArrays: empty()=false kind=0x00050000 flags=0x01050000 total(-1)=3 dims(-1)=1 size(-1)=3x1 type(0)=CV_32FC2 dims(0)=2 size(0)=3x1 type(0)=CV_32FC2")
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
|
||||
@@ -26,7 +26,9 @@ class NewOpenCVTests(unittest.TestCase):
|
||||
# github repository url
|
||||
repoUrl = 'https://raw.github.com/opencv/opencv/master'
|
||||
|
||||
def get_sample(self, filename, iscolor = cv.IMREAD_COLOR):
|
||||
def get_sample(self, filename, iscolor = None):
|
||||
if iscolor is None:
|
||||
iscolor = cv.IMREAD_COLOR
|
||||
if not filename in self.image_cache:
|
||||
filedata = None
|
||||
if NewOpenCVTests.repoPath is not None:
|
||||
|
||||
Reference in New Issue
Block a user