Esp32 cam webserver videocapture

Hello,
I’ve written a code for esp32cam to host a webserver for its camera feed. When i visit from my computer to the url (192.168.2.50/cam.jpg), the esp32cam captures a photo and shows me on the browser.

I’m running opencv library on codeblocks on a raspberry pi 4. I’ve been able to capture photo from the internet, e.g.: the following code runs perfectly and shows me picture.
VideoCapture capture("https://img.freepik.com/free-photo/purple-osteospermum-daisy-flower_1373-16.jpg");

But The following code fails to fetch image from esp32cam server and times out.
VideoCapture capture("http://192.168.2.50/cam.jpg");

I’m new to this. please help.