Skip to content
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

Use proper C++ types. #3703

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Use proper C++ types. #3703

merged 2 commits into from
Mar 26, 2024

Conversation

vrabaud
Copy link
Contributor

@vrabaud vrabaud commented Mar 21, 2024

This is necessary to get opencv/opencv#25248 working.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • 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

This is necessary to get opencv/opencv#25248
working.
@@ -59,7 +59,7 @@

inline float sqr(float x) { return x * x; }

inline float intensity(const cv::Point3_<uchar> &bgr)
inline float intensity(const cv::Point3_<unsigned char> &bgr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not uint8_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to stay close to the current OpenCV typedefs at https://github.com/opencv/opencv/blob/3aefd4862c5ee92918e15d96e9973cbfde48e5c2/modules/core/include/opencv2/core/hal/interface.h#L51
But indeed, we might as well use the proper types from <cstdint>. Should I switch to that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this proposal for 5.x -opencv/opencv#24994 , so eventually, we will switch to the <cstdint> types. Since changes in this PR do not affect public interfaces, I suggest using these types here. I'm not sure regarding opencv/opencv#25248 though, perhaps it can be partially converted to uint8_t (internal usage, C++ code) and partially to unsigned char (C-API).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: switched to uint_8_t.
For the other PR, let's not change the typedefs right now. All it does is encapsulate the OpenCV typedefs in the cv namespace, that's it. As this header is public, it prevents conflicts with other libraries that also define it in the global namespace (like SWIG), but differently (int64 is a long long int and not an int64_t like OpenCV).

@asmorkalov asmorkalov merged commit 5300337 into opencv:4.x Mar 26, 2024
10 checks passed
@asmorkalov asmorkalov mentioned this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants