Repository: opencv
Issue: Opencv Cuda is working with CPP but not Python
Labels: bug,category: build/install,category: gpu/cuda (contrib),needs investigation

### System Information

OpenCV version: 4.6.0-dev
Operating System / Platform:  WSL 2 / Ubuntu 20.04
Compiler & compiler version: GCC 9.4.0
Cuda version 11.6


### Detailed description

Hi,
I have compiled opencv with cuda support and in cpp I can access cuda and use it normally but in python I get an error about cuda device not found. 
I use tensorflow and pytorch as well and in both cases python recognize my gpu without problem.
I was using opencv version 4.5.2 and everything was OK, I don't know why I decided to upgrade my opencv to version 4.6.0 and now I have this issue. I tried to roll back to version 4.5.2 as well, but now the issue appears in all of the versions of opencv.

Here is the output of  `cv::cuda::printCudaDeviceInfo(0);` in cpp:
```
*** CUDA Device Query (Runtime API) version (CUDART static linking) ***

Device count: 1

Device 0: "NVIDIA GeForce RTX 3080 Laptop GPU"
  CUDA Driver Version / Runtime Version          11.60 / 11.60
  CUDA Capability Major/Minor version number:    8.6
  Total amount of global memory:                 16384 MBytes (17179344896 bytes)
  GPU Clock Speed:                               1.25 GHz
  Max Texture Dimension Size (x,y,z)             1D=(131072), 2D=(131072,65536), 3D=(16384,16384,16384)
  Max Layered Texture Size (dim) x layers        1D=(32768) x 2048, 2D=(32768,32768) x 2048
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per block:           1024
  Maximum sizes of each dimension of a block:    1024 x 1024 x 64
  Maximum sizes of each dimension of a grid:     2147483647 x 65535 x 65535
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and execution:                 Yes with 1 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Bus ID / PCI location ID:           1 / 0
  Compute Mode:
      Default (multiple host threads can use ::cudaSetDevice() with device simultaneously)

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version  = 11.60, CUDA Runtime Version = 11.60, NumDevs = 1
```


Here is the output of  `cv2.cuda.printCudaDeviceInfo(0)` in python:

```
*** CUDA Device Query (Runtime API) version (CUDART static linking) ***

Device count: 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cv2.error: OpenCV(4.6.0-dev) /home/masoud/Downloads/opencv/modules/core/src/cuda_info.cpp:911: error: (-217:Gpu API call) no CUDA-capable device is detected in function 'printCudaDeviceInfo'
```

I checked the opencv library version in python it is the correct version, I don't have any other version of opencv installed. I even tried on a fresh installation of wsl Ubuntu 20.04 just to make sure any other libs is not messing up here.  


the cmake output for cuda and python : 
```
--   NVIDIA CUDA:                   YES (ver 11.6, CUFFT CUBLAS FAST_MATH)
--     NVIDIA GPU arch:             86
--     NVIDIA PTX archs:
--
--   cuDNN:                         YES (ver 8.4.0)
--
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.8.10)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.8.so (ver 3.8.10)
--     numpy:                       /home/masoud/.local/lib/python3.8/site-packages/numpy/core/include (ver 1.24.0)
--     install path:                lib/python3.8/site-packages/cv2/python-3.8
--
--   Python (for build):            /usr/bin/python3
```

the output of tensorflow in python:
```
tf.config.list_physical_devices('GPU')
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
```

### Steps to reproduce

import cv2
cv2.cuda.printCudaDeviceInfo(0)

### Issue submission checklist

- [X] 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
- [X] 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)