OpenCV can't receive frame but libcamera & picamera2 works fine (imx519)

Hi guys, I have some trouble with OpenCV.

My problem is that, OpenCV throws an error which is “Can’t receive frame”.
For the first time opencv could not open the camera (while libcamera and picamer2 was working fine). I made a new image with the same bullseye and now with the 0 id it returns the mentioned error.
some basic info:
pi3b+
imx519
latest raspbian os with bullseye
opencv 4.5.5.62 (latest compatible version)

1.the camera’s connection is fine (camera works)
2.
Linux raspberrypi 5.15.84-v7+ #1613 SMP Thu Jan 5 11:59:48 GMT 2023 armv7l GNU/Linux

PRETTY_NAME=“Raspbian GNU/Linux 11 (bullseye)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“11”
VERSION=“11 (bullseye)”
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL=“only 2 links are allowed”
SUPPORT_URL=“RaspbianForums - Raspbian
BUG_REPORT_URL=“RaspbianBugs - Raspbian

MemTotal: 891488 kB
MemFree: 164760 kB
MemAvailable: 586484 kB
Buffers: 33220 kB
Cached: 443068 kB
SwapCached: 52 kB
Active: 108744 kB
Inactive: 494016 kB
Active(anon): 1088 kB
Inactive(anon): 144648 kB
Active(file): 107656 kB
Inactive(file): 349368 kB
Unevictable: 12 kB
Mlocked: 12 kB
SwapTotal: 102396 kB
SwapFree: 102140 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 126432 kB
Mapped: 146084 kB
Shmem: 19264 kB
KReclaimable: 19508 kB
Slab: 38776 kB
SReclaimable: 19508 kB
SUnreclaim: 19268 kB
KernelStack: 1928 kB
PageTables: 4760 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 548140 kB
Committed_AS: 1174912 kB
VmallocTotal: 1163264 kB
VmallocUsed: 5948 kB
VmallocChunk: 0 kB
Percpu: 448 kB
CmaTotal: 262144 kB
CmaFree: 119700 kB

[ 13.230746] imx519 10-001a: Device found is imx519
[ 13.233727] imx519 10-001a: Consider updating driver imx519 to match on endpoints

Unfortunately could not find any solution yet, I hope someone can help.
Let me know if you need any additional information

you can check out the code here:

https://docs.opencv.org/3.4/dd/d43/tutorial_py_video_display.html