-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Add Size parameter to PtrStepSz<T> #25659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Need to completely remove commits with submodules from the PR. |
|
@opencv-alalek I have removed the commits with submodules |
|
What issue do you try to solve? The PR does not contain enough add value to be merged. |
|
@asmorkalov The PR does not solve any issue. It is just an added feature. PtrStepSz seems to not give us access to size but rather cols and rows. To check for size, we need to construct using these parameters. It would be helpful if the type gave us access to size directly to use in custom functions. |
|
@asmorkalov I vote to open this PR again. Having a handy way to access the size rather than just rows and cols would make our code more terse and avoids the pitfall of confusing rows and cols (you know, OpenCV is a bit... peculiar in this regard). However, I'd add |
|
@asmorkalov thanks for reopening. Do you think the current proposal makes sense? Or should we construct |
|
The PR was discussed on the Core team meeting and decided to reject it. The PR makes the structure 2 times fatter and values duplication. Closed. |
|
|
||
| int cols; | ||
| int rows; | ||
| Size size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__CV_CUDA_HOST_DEVICE__ [[nodiscard]] cv::Size size() const
{
return cv::Size{cols, rows};
}
|
|
||
| template <typename U> | ||
| explicit PtrStepSz(const PtrStepSz<U>& d) : PtrStep<T>((T*)d.data, d.step), cols(d.cols), rows(d.rows){} | ||
| explicit PtrStepSz(const PtrStepSz<U>& d) : PtrStep<T>((T*)d.data, d.step), cols(d.cols), rows(d.rows), size(d.cols,d.rows) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicit PtrStepSz(const PtrStepSz<U>& d) : PtrStep<T>((T*)d.data, d.step), cols(d.cols), rows(d.rows) {}
|
@asmorkalov I totally understand your decision. However, what about my proposal: having a function @srinath2468 maybe you could update your pull request? Please consider to merge this PR with my proposed changed. |
|
size() makes sense then, if it's used. |
Add size() to CUDA PtrStepSz #26042 According to [cppreference.com compiler support table](https://en.cppreference.com/w/cpp/compiler_support/17), `nvcc` supports `[[nodiscard]]` from version 11. ### 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 - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake Related: #25659
Add size() to CUDA PtrStepSz opencv#26042 According to [cppreference.com compiler support table](https://en.cppreference.com/w/cpp/compiler_support/17), `nvcc` supports `[[nodiscard]]` from version 11. ### 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 - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake Related: opencv#25659
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.