Skip to content

C-API cleanup: RNG algorithms in core #26258

@Kumataro

Description

@Kumataro

System Information

OpenCV version: 4.x ( 4.10.0-303-g3901426d85 )
Operating System / Platform: Ubuntu 24.10 (Oracular Oriole) Daily Build
(at 2024-10-02 06:34 )
Compiler & compiler version: GCC 14.2.0

Detailed description

I try to build OpenCV 4.x on Ubuntu 24.10(Release Candidate/Daily build), there are `two build warnings. They are related to old C-API. We can remove and clean up them.

-- /home/kmtr/work/build4-full/modules/core/opencl_kernels_core.hpp contains the same content
[178/2567] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/rand.cpp.o
/home/kmtr/work/opencv4/modules/core/src/rand.cpp: In function ‘void cvRandArr(CvRNG*, CvArr*, int, CvScalar, CvScalar)’:
/home/kmtr/work/opencv4/modules/core/src/rand.cpp:761:38: warning: casting ‘CvRNG’ {aka ‘long unsigned int’} to ‘cv::RNG&’ does not use ‘cv::RNG::RNG(uint64)’ [-Wcast-user-defined]
  761 |     cv::RNG& rng = _rng ? (cv::RNG&)*_rng : cv::theRNG();
      |                                      ^~~~
/home/kmtr/work/opencv4/modules/core/src/rand.cpp: In function ‘void cvRandShuffle(CvArr*, CvRNG*, double)’:
/home/kmtr/work/opencv4/modules/core/src/rand.cpp:769:38: warning: casting ‘CvRNG’ {aka ‘long unsigned int’} to ‘cv::RNG&’ does not use ‘cv::RNG::RNG(uint64)’ [-Wcast-user-defined]
  769 |     cv::RNG& rng = _rng ? (cv::RNG&)*_rng : cv::theRNG();
      |

Steps to reproduce

  1. Install Ubuntu 24.10
  2. sudo apt install build-essential git cmake ...
  3. git clone https://github.com/opencv/opencv.git opencv4
  4. cmake -S opencv4 -B build4-main
  5. cmake --build build4-main

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions