mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 20:50:25 +08:00
Merge pull request #21341 from alalek:issue_20930_3.4
This commit is contained in:
commit
655d381ef3
@ -103,6 +103,21 @@ String dumpRotatedRect(const RotatedRect& argument)
|
|||||||
argument.size.height, argument.angle);
|
argument.size.height, argument.angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CV_WRAP static inline
|
||||||
|
RotatedRect testRotatedRect(float x, float y, float w, float h, float angle)
|
||||||
|
{
|
||||||
|
return RotatedRect(Point2f(x, y), Size2f(w, h), angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
CV_WRAP static inline
|
||||||
|
std::vector<RotatedRect> testRotatedRectVector(float x, float y, float w, float h, float angle)
|
||||||
|
{
|
||||||
|
std::vector<RotatedRect> result;
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
result.push_back(RotatedRect(Point2f(x + i, y + 2 * i), Size2f(w, h), angle + 10 * i));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
CV_WRAP static inline
|
CV_WRAP static inline
|
||||||
String dumpRange(const Range& argument)
|
String dumpRange(const Range& argument)
|
||||||
{
|
{
|
||||||
|
@ -518,6 +518,10 @@ template <class T>
|
|||||||
struct IsRepresentableAsMatDataType<T, typename VoidType<typename DataType<T>::channel_type>::type> : TrueType
|
struct IsRepresentableAsMatDataType<T, typename VoidType<typename DataType<T>::channel_type>::type> : TrueType
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// https://github.com/opencv/opencv/issues/20930
|
||||||
|
template <> struct IsRepresentableAsMatDataType<RotatedRect, void> : FalseType {};
|
||||||
|
|
||||||
} // namespace traits
|
} // namespace traits
|
||||||
|
|
||||||
typedef std::vector<uchar> vector_uchar;
|
typedef std::vector<uchar> vector_uchar;
|
||||||
|
@ -583,6 +583,18 @@ class Arguments(NewOpenCVTests):
|
|||||||
self.assertEqual(ints.dtype, np.int32, "Vector of integers has wrong elements type")
|
self.assertEqual(ints.dtype, np.int32, "Vector of integers has wrong elements type")
|
||||||
self.assertEqual(ints.shape, expected_shape, "Vector of integers has wrong shape.")
|
self.assertEqual(ints.shape, expected_shape, "Vector of integers has wrong shape.")
|
||||||
|
|
||||||
|
def test_result_rotated_rect_issue_20930(self):
|
||||||
|
rr = cv.utils.testRotatedRect(10, 20, 100, 200, 45)
|
||||||
|
self.assertTrue(isinstance(rr, tuple), msg=type(rr))
|
||||||
|
self.assertEqual(len(rr), 3)
|
||||||
|
|
||||||
|
rrv = cv.utils.testRotatedRectVector(10, 20, 100, 200, 45)
|
||||||
|
self.assertTrue(isinstance(rrv, tuple), msg=type(rrv))
|
||||||
|
self.assertEqual(len(rrv), 10)
|
||||||
|
|
||||||
|
rr = rrv[0]
|
||||||
|
self.assertTrue(isinstance(rr, tuple), msg=type(rrv))
|
||||||
|
self.assertEqual(len(rr), 3)
|
||||||
|
|
||||||
class SamplesFindFile(NewOpenCVTests):
|
class SamplesFindFile(NewOpenCVTests):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user