cuda: Fix GpuMat::copyTo and GpuMat::converTo python bindings#24089
Merged
asmorkalov merged 1 commit intoopencv:4.xfrom Aug 9, 2023
Merged
Conversation
VadimLevin
approved these changes
Aug 7, 2023
Contributor
VadimLevin
left a comment
There was a problem hiding this comment.
Thanks for contribution.
Generated overloads look correct:
static PyObject* pyopencv_cv_cuda_cuda_GpuMat_convertTo(PyObject* self, PyObject* py_args, PyObject* kw)
{
using namespace cv::cuda;
Ptr<cv::cuda::GpuMat> * self1 = 0;
if (!pyopencv_cuda_GpuMat_getp(self, self1))
return failmsgp("Incorrect type of self (must be 'cuda_GpuMat' or its derivative)");
Ptr<cv::cuda::GpuMat> _self_ = *(self1);
pyPrepareArgumentConversionErrorsStorage(3);
{
PyObject* pyobj_dst = NULL;
GpuMat dst;
PyObject* pyobj_rtype = NULL;
int rtype=0;
PyObject* pyobj_stream = NULL;
Stream stream=Stream::Null();
const char* keywords[] = { "rtype", "stream", "dst", NULL };
if( PyArg_ParseTupleAndKeywords(py_args, kw, "OO|O:cuda_GpuMat.convertTo", (char**)keywords, &pyobj_rtype, &pyobj_stream, &pyobj_dst) &&
pyopencv_to_safe(pyobj_dst, dst, ArgInfo("dst", 1)) &&
pyopencv_to_safe(pyobj_rtype, rtype, ArgInfo("rtype", 0)) &&
pyopencv_to_safe(pyobj_stream, stream, ArgInfo("stream", 0)) )
{
ERRWRAP2(_self_->convertTo(dst, rtype, stream));
return pyopencv_from(dst);
}
pyPopulateArgumentConversionErrors();
}
{
PyObject* pyobj_dst = NULL;
GpuMat dst;
PyObject* pyobj_rtype = NULL;
int rtype=0;
PyObject* pyobj_alpha = NULL;
double alpha=1.0;
PyObject* pyobj_beta = NULL;
double beta=0.0;
const char* keywords[] = { "rtype", "dst", "alpha", "beta", NULL };
if( PyArg_ParseTupleAndKeywords(py_args, kw, "O|OOO:cuda_GpuMat.convertTo", (char**)keywords, &pyobj_rtype, &pyobj_dst, &pyobj_alpha, &pyobj_beta) &&
pyopencv_to_safe(pyobj_dst, dst, ArgInfo("dst", 1)) &&
pyopencv_to_safe(pyobj_rtype, rtype, ArgInfo("rtype", 0)) &&
pyopencv_to_safe(pyobj_alpha, alpha, ArgInfo("alpha", 0)) &&
pyopencv_to_safe(pyobj_beta, beta, ArgInfo("beta", 0)) )
{
ERRWRAP2(_self_->convertTo(dst, rtype, alpha, beta));
return pyopencv_from(dst);
}
pyPopulateArgumentConversionErrors();
}
{
PyObject* pyobj_dst = NULL;
GpuMat dst;
PyObject* pyobj_rtype = NULL;
int rtype=0;
PyObject* pyobj_alpha = NULL;
double alpha=0;
PyObject* pyobj_beta = NULL;
double beta=0;
PyObject* pyobj_stream = NULL;
Stream stream=Stream::Null();
const char* keywords[] = { "rtype", "alpha", "beta", "stream", "dst", NULL };
if( PyArg_ParseTupleAndKeywords(py_args, kw, "OOOO|O:cuda_GpuMat.convertTo", (char**)keywords, &pyobj_rtype, &pyobj_alpha, &pyobj_beta, &pyobj_stream, &pyobj_dst) &&
pyopencv_to_safe(pyobj_dst, dst, ArgInfo("dst", 1)) &&
pyopencv_to_safe(pyobj_rtype, rtype, ArgInfo("rtype", 0)) &&
pyopencv_to_safe(pyobj_alpha, alpha, ArgInfo("alpha", 0)) &&
pyopencv_to_safe(pyobj_beta, beta, ArgInfo("beta", 0)) &&
pyopencv_to_safe(pyobj_stream, stream, ArgInfo("stream", 0)) )
{
ERRWRAP2(_self_->convertTo(dst, rtype, alpha, beta, stream));
return pyopencv_from(dst);
}
pyPopulateArgumentConversionErrors();
}
pyRaiseCVOverloadException("convertTo");
return NULL;
}Corresponding stubs:
@typing.overload
def convertTo(self, rtype: int, stream: Stream, dst: GpuMat | None = ...) -> GpuMat: ...
@typing.overload
def convertTo(self, rtype: int, dst: GpuMat | None = ..., alpha: float = ..., beta: float = ...) -> GpuMat: ...
@typing.overload
def convertTo(self, rtype: int, alpha: float, beta: float, stream: Stream, dst: GpuMat | None = ...) -> GpuMat: ...LGTM 👍
Merged
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24038 and added non exhaustive python tests to verify functionality.
@VadimLevin
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.