mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
add test
This commit is contained in:
parent
bc6544c0bc
commit
f1055a7e91
@ -4973,6 +4973,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! @cond IGNORED
|
//! @cond IGNORED
|
||||||
|
CV_EXPORTS_W void testMatxPythonConverter(InputArray src, OutputArray dst, const Vec2d& defaultParam = Vec2d(-5, 5));
|
||||||
|
|
||||||
// === LineIterator implementation ===
|
// === LineIterator implementation ===
|
||||||
|
|
||||||
|
19
modules/imgproc/misc/python/test/test_matx_converter.py
Normal file
19
modules/imgproc/misc/python/test/test_matx_converter.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
import cv2 as cv
|
||||||
|
from cv2 import testMatxPythonConverter
|
||||||
|
from tests_common import NewOpenCVTests
|
||||||
|
|
||||||
|
|
||||||
|
class MatxConverterTest(NewOpenCVTests):
|
||||||
|
def test_matxconverter(self):
|
||||||
|
samples = ['samples/data/lena.jpg', 'cv/cascadeandhog/images/mona-lisa.png']
|
||||||
|
|
||||||
|
for sample in samples:
|
||||||
|
img = self.get_sample(sample)
|
||||||
|
out = testMatxPythonConverter(img)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
NewOpenCVTests.bootstrap()
|
||||||
|
|
||||||
|
|
9
modules/imgproc/src/test_matx_converter.cpp
Normal file
9
modules/imgproc/src/test_matx_converter.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "precomp.hpp"
|
||||||
|
|
||||||
|
namespace cv{
|
||||||
|
void testMatxPythonConverter(InputArray _src, OutputArray _dst, const Vec2d& defaultParam){
|
||||||
|
printf("%f %f\n", defaultParam[0], defaultParam[1]);
|
||||||
|
Mat src = _src.getMat();
|
||||||
|
src.copyTo(_dst);
|
||||||
|
}
|
||||||
|
}
|
@ -62,6 +62,9 @@ PyObject* pyopencv_from(const T& src) { return PyOpenCV_Converter<T>::from(src);
|
|||||||
template<typename _Tp, int m, int n>
|
template<typename _Tp, int m, int n>
|
||||||
bool pyopencv_to(PyObject* o, cv::Matx<_Tp, m, n>& mx, const ArgInfo& info)
|
bool pyopencv_to(PyObject* o, cv::Matx<_Tp, m, n>& mx, const ArgInfo& info)
|
||||||
{
|
{
|
||||||
|
if (!o || o == Py_None)
|
||||||
|
return true;
|
||||||
|
|
||||||
cv::Mat tmp;
|
cv::Mat tmp;
|
||||||
if (!pyopencv_to(o, tmp, info)) {
|
if (!pyopencv_to(o, tmp, info)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user