mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #24074 from Kumataro/fix24057
Python: support tuple src for cv::add()/subtract()/... #24074 fix https://github.com/opencv/opencv/issues/24057 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ x The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -109,7 +109,7 @@ gen_template_set_prop_from_map = Template("""
|
||||
if( PyMapping_HasKeyString(src, (char*)"$propname") )
|
||||
{
|
||||
tmp = PyMapping_GetItemString(src, (char*)"$propname");
|
||||
ok = tmp && pyopencv_to_safe(tmp, dst.$propname, ArgInfo("$propname", false));
|
||||
ok = tmp && pyopencv_to_safe(tmp, dst.$propname, ArgInfo("$propname", 0));
|
||||
Py_DECREF(tmp);
|
||||
if(!ok) return false;
|
||||
}""")
|
||||
@@ -163,7 +163,7 @@ static int pyopencv_${name}_set_${member}(pyopencv_${name}_t* p, PyObject *value
|
||||
PyErr_SetString(PyExc_TypeError, "Cannot delete the ${member} attribute");
|
||||
return -1;
|
||||
}
|
||||
return pyopencv_to_safe(value, p->v${access}${member}, ArgInfo("value", false)) ? 0 : -1;
|
||||
return pyopencv_to_safe(value, p->v${access}${member}, ArgInfo("value", 0)) ? 0 : -1;
|
||||
}
|
||||
""")
|
||||
|
||||
@@ -181,7 +181,7 @@ static int pyopencv_${name}_set_${member}(pyopencv_${name}_t* p, PyObject *value
|
||||
failmsgp("Incorrect type of object (must be '${name}' or its derivative)");
|
||||
return -1;
|
||||
}
|
||||
return pyopencv_to_safe(value, _self_${access}${member}, ArgInfo("value", false)) ? 0 : -1;
|
||||
return pyopencv_to_safe(value, _self_${access}${member}, ArgInfo("value", 0)) ? 0 : -1;
|
||||
}
|
||||
""")
|
||||
|
||||
@@ -492,6 +492,10 @@ class ArgInfo(object):
|
||||
def inputarg(self):
|
||||
return '/O' not in self._modifiers
|
||||
|
||||
@property
|
||||
def arithm_op_src_arg(self):
|
||||
return '/AOS' in self._modifiers
|
||||
|
||||
@property
|
||||
def outputarg(self):
|
||||
return '/O' in self._modifiers or '/IO' in self._modifiers
|
||||
@@ -517,7 +521,9 @@ class ArgInfo(object):
|
||||
"UMat", "vector_UMat"] # or self.tp.startswith("vector")
|
||||
|
||||
def crepr(self):
|
||||
return "ArgInfo(\"%s\", %d)" % (self.name, self.outputarg)
|
||||
arg = 0x01 if self.outputarg else 0x0
|
||||
arg += 0x02 if self.arithm_op_src_arg else 0x0
|
||||
return "ArgInfo(\"%s\", %d)" % (self.name, arg)
|
||||
|
||||
|
||||
def find_argument_class_info(argument_type, function_namespace,
|
||||
|
||||
Reference in New Issue
Block a user