mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Change Scalar assignment in Python from single value
This commit is contained in:
parent
e60a7c0d49
commit
f9d7f47e28
@ -446,5 +446,11 @@ class dnn_test(NewOpenCVTests):
|
|||||||
|
|
||||||
normAssert(self, real_output, gold_output, "", getDefaultThreshold(target))
|
normAssert(self, real_output, gold_output, "", getDefaultThreshold(target))
|
||||||
|
|
||||||
|
def test_scalefactor_assign(self):
|
||||||
|
params = cv.dnn.Image2BlobParams()
|
||||||
|
self.assertEqual(params.scalefactor, (1.0, 1.0, 1.0, 1.0))
|
||||||
|
params.scalefactor = 2.0
|
||||||
|
self.assertEqual(params.scalefactor, (2.0, 0.0, 0.0, 0.0))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
NewOpenCVTests.bootstrap()
|
NewOpenCVTests.bootstrap()
|
||||||
|
@ -327,7 +327,7 @@ bool pyopencv_to(PyObject *o, Scalar& s, const ArgInfo& info)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (PyFloat_Check(o) || PyInt_Check(o)) {
|
if (PyFloat_Check(o) || PyInt_Check(o)) {
|
||||||
s[0] = PyFloat_AsDouble(o);
|
s = PyFloat_AsDouble(o);
|
||||||
} else {
|
} else {
|
||||||
failmsg("Scalar value for argument '%s' is not numeric", info.name);
|
failmsg("Scalar value for argument '%s' is not numeric", info.name);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user